Mass update
This commit is contained in:
parent
7a5dfd22a7
commit
e9ec7eb2f2
1
404.html
1
404.html
@ -10,6 +10,7 @@
|
|||||||
background-color: #444;
|
background-color: #444;
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
}
|
}
|
||||||
|
|
||||||
h3 {
|
h3 {
|
||||||
font-size: 60px;
|
font-size: 60px;
|
||||||
color: #eee;
|
color: #eee;
|
||||||
|
8
AI.php
8
AI.php
@ -184,14 +184,14 @@ while ($pl = mysql_fetch_array($sp)) {
|
|||||||
if ($pl['timereg'] == 0) {
|
if ($pl['timereg'] == 0) {
|
||||||
mysql_query('UPDATE `users` SET `timereg` = "' . time() . '" WHERE `id` = "' . $pl['id'] . '" LIMIT 1');
|
mysql_query('UPDATE `users` SET `timereg` = "' . time() . '" WHERE `id` = "' . $pl['id'] . '" LIMIT 1');
|
||||||
} else {
|
} else {
|
||||||
mysql_query('UPDATE `users` SET `online` = "' . time() . '" WHERE `id` = "' . $pl['id'] . '" LIMIT 1');
|
User::setOnline($pl['id']);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($pl['bot'] == 0) {
|
if ($pl['bot'] == 0) {
|
||||||
mysql_query('UPDATE `stats` SET `bot` = "2" WHERE `id` = "' . $pl['id'] . '" LIMIT 1');
|
mysql_query('UPDATE `stats` SET `bot` = "2" WHERE `id` = "' . $pl['id'] . '" LIMIT 1');
|
||||||
}
|
}
|
||||||
|
|
||||||
mysql_query('UPDATE `users` SET `online` = "' . time() . '" WHERE `id` = "' . $pl['id'] . '" LIMIT 1');
|
User::setOnline($pl['id']);
|
||||||
|
|
||||||
BotLogic::start($pl['id']);
|
BotLogic::start($pl['id']);
|
||||||
|
|
||||||
@ -204,14 +204,14 @@ while ($pl = mysql_fetch_array($sp)) {
|
|||||||
if ($pl['timereg'] == 0) {
|
if ($pl['timereg'] == 0) {
|
||||||
mysql_query('UPDATE `users` SET `timereg` = "' . time() . '" WHERE `id` = "' . $pl['id'] . '" LIMIT 1');
|
mysql_query('UPDATE `users` SET `timereg` = "' . time() . '" WHERE `id` = "' . $pl['id'] . '" LIMIT 1');
|
||||||
} else {
|
} else {
|
||||||
mysql_query('UPDATE `users` SET `online` = "' . time() . '" WHERE `id` = "' . $pl['id'] . '" LIMIT 1');
|
User::setOnline($pl['id']);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($pl['bot'] == 0) {
|
if ($pl['bot'] == 0) {
|
||||||
mysql_query('UPDATE `stats` SET `bot` = "2" WHERE `id` = "' . $pl['id'] . '" LIMIT 1');
|
mysql_query('UPDATE `stats` SET `bot` = "2" WHERE `id` = "' . $pl['id'] . '" LIMIT 1');
|
||||||
}
|
}
|
||||||
mysql_query('UPDATE `stats` SET `nextAct` = "' . time() . '" WHERE `id` = "' . $pl['id'] . '" LIMIT 1');
|
mysql_query('UPDATE `stats` SET `nextAct` = "' . time() . '" WHERE `id` = "' . $pl['id'] . '" LIMIT 1');
|
||||||
mysql_query('UPDATE `users` SET `online` = "' . time() . '" WHERE `id` = "' . $pl['id'] . '" LIMIT 1');
|
User::setOnline($pl['id']);
|
||||||
|
|
||||||
echo '*';
|
echo '*';
|
||||||
}
|
}
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -8,7 +8,7 @@
|
|||||||
* 11. ???
|
* 11. ???
|
||||||
*/
|
*/
|
||||||
|
|
||||||
use Insallah\Db;
|
use Core\Db;
|
||||||
|
|
||||||
class Chat
|
class Chat
|
||||||
{
|
{
|
||||||
|
@ -4,13 +4,27 @@ namespace Core;
|
|||||||
|
|
||||||
class Config
|
class Config
|
||||||
{
|
{
|
||||||
|
private static self $instance;
|
||||||
|
private function __construct()
|
||||||
|
{
|
||||||
|
error_reporting(E_ALL ^ E_NOTICE);
|
||||||
|
setlocale(LC_CTYPE, "ru_RU.CP1251");
|
||||||
|
|
||||||
|
ini_set('display_errors', 'Off');
|
||||||
|
ini_set('default_charset', 'windows-1251');
|
||||||
|
ini_set('date.timezone', 'Europe/Moscow');
|
||||||
|
|
||||||
|
header('Cache-Control: no-cache, no-store, must-revalidate');
|
||||||
|
header('Pragma: no-cache');
|
||||||
|
header('Expires: 0');
|
||||||
|
}
|
||||||
|
|
||||||
public static function get(?string $key = null)
|
public static function get(?string $key = null)
|
||||||
{
|
{
|
||||||
$c['ver'] = '1.8.3.7';
|
$c['ver'] = '1.8.3.7';
|
||||||
/* Êîíôèãóðàöèè èãðû */
|
/* Êîíôèãóðàöèè èãðû */
|
||||||
$c['name'] = 'Áîéöîâñêèé Êëóá';
|
$c['name'] = 'Áîéöîâñêèé Êëóá';
|
||||||
$c['title'] = '«' . $c['name'] . '» - Áåñïëàòíàÿ,áðàóçåðíàÿ îíëàéí èãðà'; //Íàçâàíèå èãðû
|
$c['title'] = 'Íîâûé «' . $c['name'] . '» - Áåñïëàòíàÿ,áðàóçåðíàÿ îíëàéí èãðà'; //Íàçâàíèå èãðû
|
||||||
$c['title2'] = ' - Áåñïëàòíàÿ, îíëàéí èãðà ïîñâÿùåííàÿ ñðàæåíèÿì è ìàãèè!';
|
$c['title2'] = ' - Áåñïëàòíàÿ, îíëàéí èãðà ïîñâÿùåííàÿ ñðàæåíèÿì è ìàãèè!';
|
||||||
$c['title3'] = $c['name'];
|
$c['title3'] = $c['name'];
|
||||||
$c['keys'] = $c['name'] . ', combats.com, ' . $c['name'] . ' èãðà, ' . $c['name'] . ' èãðàòü, èãðà ' . $c['name'] . ', ñòàðûé ' . $c['name'] . ', ' . $c['name'] . ' îíëàéí èãðà, ' . $c['name'] . ' áðàóçåðíàÿ èãðà, èãðàòü â ' . $c['name'] . ', èãðà áê, áê èãðà, ñòàðûé áê, èãðàòü â áê, áê îíëàéí èãðà, íîâûé áê, Ëåãåíäàðíûé ' . $c['name'] . ', ëåãåíäàðíûé áê, combats, êîìáàòñ, combats ru, combats com, OldBK, oldbk ru, oldbk com, îëäáê, old bk, îëä áê, mycombats, rebk, recombats, oldcombats, obk2'; //Êëþ÷åâûå ñëîâà META
|
$c['keys'] = $c['name'] . ', combats.com, ' . $c['name'] . ' èãðà, ' . $c['name'] . ' èãðàòü, èãðà ' . $c['name'] . ', ñòàðûé ' . $c['name'] . ', ' . $c['name'] . ' îíëàéí èãðà, ' . $c['name'] . ' áðàóçåðíàÿ èãðà, èãðàòü â ' . $c['name'] . ', èãðà áê, áê èãðà, ñòàðûé áê, èãðàòü â áê, áê îíëàéí èãðà, íîâûé áê, Ëåãåíäàðíûé ' . $c['name'] . ', ëåãåíäàðíûé áê, combats, êîìáàòñ, combats ru, combats com, OldBK, oldbk ru, oldbk com, îëäáê, old bk, îëä áê, mycombats, rebk, recombats, oldcombats, obk2'; //Êëþ÷åâûå ñëîâà META
|
||||||
@ -23,7 +37,8 @@ class Config
|
|||||||
$c['thiscity'] = 'capitalcity';
|
$c['thiscity'] = 'capitalcity';
|
||||||
$c['capitalcity'] = $c['host'];
|
$c['capitalcity'] = $c['host'];
|
||||||
$c['abandonedplain'] = $c['host'];
|
$c['abandonedplain'] = $c['host'];
|
||||||
$c['exit'] = '<script>top.location="https://' . $c['host'] . '/";</script>';
|
$c['https'] = 'https://' . $c['host'] . DIRECTORY_SEPARATOR;
|
||||||
|
$c['exit'] = '<script>top.location="' . $c['https'] . '";</script>';
|
||||||
|
|
||||||
//Âàëþòà
|
//Âàëþòà
|
||||||
$c['curency_name'] = 'RUB';
|
$c['curency_name'] = 'RUB';
|
||||||
@ -68,20 +83,17 @@ class Config
|
|||||||
$c['securetime'] = 0; //Âðåìÿ ïîñëåäíåãî âîçìîæíîãî âçëîìà ïåðñîâ (ïîäáîð ïàðîëÿ ïî áàçàì äàííûõ äðóãèõ èãð)
|
$c['securetime'] = 0; //Âðåìÿ ïîñëåäíåãî âîçìîæíîãî âçëîìà ïåðñîâ (ïîäáîð ïàðîëÿ ïî áàçàì äàííûõ äðóãèõ èãð)
|
||||||
|
|
||||||
$c['copyright'] = 'Copyright © ' . date('Y') . ' « Íîâûé Áîéöîâñêèé Êëóá »';
|
$c['copyright'] = 'Copyright © ' . date('Y') . ' « Íîâûé Áîéöîâñêèé Êëóá »';
|
||||||
|
$c['db_user'] = 'newcom1_abk';
|
||||||
|
$c['db_name'] = 'newcom1_abk';
|
||||||
|
$c['db_password'] = '4nWYsIM[c?}P';
|
||||||
return $c[$key] ?? $c;
|
return $c[$key] ?? $c;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function init(): void
|
public static function init(): Config
|
||||||
{
|
{
|
||||||
error_reporting(E_ALL ^ E_NOTICE);
|
if (!isset(self::$instance)) {
|
||||||
setlocale(LC_CTYPE, "ru_RU.CP1251");
|
self::$instance = new static();
|
||||||
|
}
|
||||||
ini_set('display_errors', 'Off');
|
return self::$instance;
|
||||||
ini_set('default_charset', 'windows-1251');
|
|
||||||
ini_set('date.timezone', 'Europe/Moscow');
|
|
||||||
|
|
||||||
header('Cache-Control: no-cache, no-store, must-revalidate');
|
|
||||||
header('Pragma: no-cache');
|
|
||||||
header('Expires: 0');
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,34 +1,44 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
# Let's hope it will work.
|
|
||||||
|
|
||||||
namespace Core;
|
namespace Core;
|
||||||
|
|
||||||
use PDO;
|
use PDO;
|
||||||
|
|
||||||
class Database
|
class Database
|
||||||
{
|
{
|
||||||
private const DB = 'newcom1_abk';
|
private static self $instance;
|
||||||
private const USER = 'newcom1_abk';
|
protected static PDO $db;
|
||||||
private const PASSWORD = '4nWYsIM[c?}P';
|
|
||||||
private const DSN = 'mysql:host=localhost;dbname=' . self::DB;
|
|
||||||
|
|
||||||
//todo: remove PDO from files and connect through new pdoinit().
|
/**
|
||||||
public static function init(): PDO
|
* Singleton.
|
||||||
{
|
*/
|
||||||
|
private function __construct() {
|
||||||
mysql_select_db(self::DB, mysql_connect('localhost', self::USER, self::PASSWORD));
|
mysql_select_db(Config::get('db_name'), mysql_connect('localhost', Config::get('db_user'), Config::get('db_password')));
|
||||||
mysql_query('SET NAMES cp1251');
|
mysql_query('SET NAMES cp1251');
|
||||||
|
|
||||||
return self::pdoinit();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Для совместимости со старыми функциями mysql_*.
|
||||||
|
* @return Database
|
||||||
|
*/
|
||||||
|
public static function init(): Database
|
||||||
|
{
|
||||||
|
if (!isset(self::$instance)) {
|
||||||
|
self::$instance = new static();
|
||||||
|
}
|
||||||
|
return self::$instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Новое подключение к БД.
|
||||||
|
* @return PDO
|
||||||
|
*/
|
||||||
public static function pdoinit(): PDO
|
public static function pdoinit(): PDO
|
||||||
{
|
{
|
||||||
return new PDO(
|
return new PDO(
|
||||||
self::DSN,
|
'mysql:host=localhost;dbname=' . Config::get('db_name'),
|
||||||
self::USER,
|
Config::get('db_user'),
|
||||||
self::PASSWORD,
|
Config::get('db_password'),
|
||||||
[
|
[
|
||||||
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
|
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
|
||||||
PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC,
|
PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC,
|
||||||
|
144
_incl_data/class/Core/Db.php
Normal file
144
_incl_data/class/Core/Db.php
Normal file
@ -0,0 +1,144 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Core;
|
||||||
|
|
||||||
|
use Exception;
|
||||||
|
use PDO;
|
||||||
|
use PDOException;
|
||||||
|
use PDOStatement;
|
||||||
|
|
||||||
|
class Db
|
||||||
|
{
|
||||||
|
|
||||||
|
private static PDO $db;
|
||||||
|
private static self $instance;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* DB constructor.
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
self::$db = Database::pdoinit();
|
||||||
|
} catch (PDOException $e) {
|
||||||
|
throw new Exception($e->getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static function init(): void
|
||||||
|
{
|
||||||
|
self::$instance ??= new self();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $stmt
|
||||||
|
* @return PDOStatement
|
||||||
|
*/
|
||||||
|
private static function query(string $stmt): PDOStatement
|
||||||
|
{
|
||||||
|
self::init();
|
||||||
|
return self::$db->query($stmt);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $stmt
|
||||||
|
* @return PDOStatement
|
||||||
|
*/
|
||||||
|
public static function prepare(string $stmt): PDOStatement
|
||||||
|
{
|
||||||
|
self::init();
|
||||||
|
return self::$db->prepare($stmt);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $query
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
|
static public function exec(string $query): int
|
||||||
|
{
|
||||||
|
self::init();
|
||||||
|
return self::$db->exec($query);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
static public function lastInsertId(): string
|
||||||
|
{
|
||||||
|
self::init();
|
||||||
|
return self::$db->lastInsertId();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $query
|
||||||
|
* @param array $args
|
||||||
|
* @return PDOStatement
|
||||||
|
*/
|
||||||
|
public static function run(string $query, array $args = []): PDOStatement
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
if (!$args) {
|
||||||
|
return self::query($query);
|
||||||
|
}
|
||||||
|
$stmt = self::prepare($query);
|
||||||
|
$stmt->execute($args);
|
||||||
|
return $stmt;
|
||||||
|
} catch (PDOException $e) {
|
||||||
|
throw new PDOException($e->getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $query
|
||||||
|
* @param array $args
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public static function getRow(string $query, array $args = [])
|
||||||
|
{
|
||||||
|
return self::run($query, $args)->fetch();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $query
|
||||||
|
* @param array $args
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public static function getRows(string $query, array $args = []): array
|
||||||
|
{
|
||||||
|
return self::run($query, $args)->fetchAll();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $query
|
||||||
|
* @param array $args
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public static function getValue(string $query, array $args = [])
|
||||||
|
{
|
||||||
|
$result = self::getRow($query, $args);
|
||||||
|
if (!empty($result)) {
|
||||||
|
$result = array_shift($result);
|
||||||
|
}
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $query
|
||||||
|
* @param array $args
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public static function getColumn(string $query, array $args = []): array
|
||||||
|
{
|
||||||
|
return self::run($query, $args)->fetchAll(PDO::FETCH_COLUMN);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $query
|
||||||
|
* @param array $args
|
||||||
|
*/
|
||||||
|
public static function sql(string $query, array $args = [])
|
||||||
|
{
|
||||||
|
self::run($query, $args);
|
||||||
|
}
|
||||||
|
}
|
@ -1,18 +1,19 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
use Insallah\Db;
|
use Core\Config;
|
||||||
|
use Core\Db;
|
||||||
|
|
||||||
class FightRequest
|
class FightRequest
|
||||||
{
|
{
|
||||||
private $z1n = [4 => 'ãðóïïîâûå', 5 => 'õàîòè÷íûå'];
|
private array $z1n = [4 => 'ãðóïïîâûå', 5 => 'õàîòè÷íûå'];
|
||||||
private $z2n = [4 => 'ãðóïïîâîãî', 5 => 'õàîòè÷íîãî'];
|
private array $z2n = [4 => 'ãðóïïîâîãî', 5 => 'õàîòè÷íîãî'];
|
||||||
private $backTest = false; // Äëÿ ïðîâåðîê õàîòè÷åñêèõ ïîåäèíêîâ.
|
private bool $backTest = false; // Äëÿ ïðîâåðîê õàîòè÷åñêèõ ïîåäèíêîâ.
|
||||||
private static $bcktst;
|
private static bool $bcktst;
|
||||||
/**@var User $u */
|
|
||||||
private $u;
|
private User $u;
|
||||||
private $zv_see;
|
private ?int $zv_see = null;
|
||||||
public $test_s = '';
|
public string $test_s = '';
|
||||||
public $error = '';
|
public string $error = '';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Çàÿâêè íà áîé.
|
* Çàÿâêè íà áîé.
|
||||||
@ -46,7 +47,7 @@ class FightRequest
|
|||||||
if (!$eff['id2']) {
|
if (!$eff['id2']) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Db::run(
|
Db::sql(
|
||||||
'insert into eff_users (overType, id_eff, uid, name, timeUse, data) values (?,?,?,?,unix_timestamp(),?)',
|
'insert into eff_users (overType, id_eff, uid, name, timeUse, data) values (?,?,?,?,unix_timestamp(),?)',
|
||||||
[$eff['oneType'], $eff['id2'], $uid, $eff['mname'], $eff['mdata']]
|
[$eff['oneType'], $eff['id2'], $uid, $eff['mname'], $eff['mdata']]
|
||||||
);
|
);
|
||||||
@ -98,10 +99,8 @@ class FightRequest
|
|||||||
}
|
}
|
||||||
if ($pl['users_in'] > 1) {
|
if ($pl['users_in'] > 1) {
|
||||||
//Íà÷àëî òóðíèðà
|
//Íà÷àëî òóðíèðà
|
||||||
mysql_query(
|
Db::sql('update turnirs set time = unix_timestamp() + ?, status = 1 where id = ?', [$pl['time3'], $pl['id']]);
|
||||||
'UPDATE `turnirs` SET `time` = "' . (time(
|
|
||||||
) + $pl['time3']) . '",`status` = "1" WHERE `id` = "' . $pl['id'] . '" LIMIT 1'
|
|
||||||
);
|
|
||||||
$usp = mysql_query(
|
$usp = mysql_query(
|
||||||
'SELECT * FROM `users` WHERE `inTurnirnew` = "' . $pl['id'] . '" LIMIT ' . $pl['users_in']
|
'SELECT * FROM `users` WHERE `inTurnirnew` = "' . $pl['id'] . '" LIMIT ' . $pl['users_in']
|
||||||
);
|
);
|
||||||
@ -1567,7 +1566,7 @@ class FightRequest
|
|||||||
echo '<br><br><br><b><font color="black"><center>Ïðèíèìàòü ó÷àñòèå â òóðíèðå òîëüêî ñ ïåðâîãî óðîâíÿ.</center></font></b>';
|
echo '<br><br><br><b><font color="black"><center>Ïðèíèìàòü ó÷àñòèå â òóðíèðå òîëüêî ñ ïåðâîãî óðîâíÿ.</center></font></b>';
|
||||||
$this->zv_see = 0;
|
$this->zv_see = 0;
|
||||||
} elseif ($r == 10) {
|
} elseif ($r == 10) {
|
||||||
|
if (\Insallah\Tournament::IS_ENABLED) {
|
||||||
/** Òóðíèðû by Insallah*/
|
/** Òóðíèðû by Insallah*/
|
||||||
# Çàùèòà îò F5
|
# Çàùèòà îò F5
|
||||||
if (!isset($_SESSION['bypass'])) {
|
if (!isset($_SESSION['bypass'])) {
|
||||||
@ -1576,11 +1575,77 @@ class FightRequest
|
|||||||
if ($_SERVER['REQUEST_METHOD'] === 'POST' && $_POST['key'] == $_SESSION['bypass']) {
|
if ($_SERVER['REQUEST_METHOD'] === 'POST' && $_POST['key'] == $_SESSION['bypass']) {
|
||||||
unset($_SESSION['bypass']);
|
unset($_SESSION['bypass']);
|
||||||
if (array_key_exists('tournament_start', $_POST)) {
|
if (array_key_exists('tournament_start', $_POST)) {
|
||||||
(new Insallah\Tournaments\Tournament())->join($this->u->info['id']);
|
(new \Insallah\Tournament())->join($this->u->info['id']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$tlist = new \Insallah\Tournaments\View\TList($this->u);
|
##
|
||||||
echo $tlist; # Ôîðìèðóåì ñïèñîê èäóùèõ òóðíèðîâ.
|
# Ôîðìèðóåì ñïèñîê èäóùèõ òóðíèðîâ.
|
||||||
|
$tournamentsList = Db::getRows('select * from tournaments');
|
||||||
|
$tournaments = '<ul>';
|
||||||
|
foreach ($tournamentsList as $tournament) {
|
||||||
|
$time = $tournament['start_time'] === -1 ? 'Òóðíèð óæå íà÷àëñÿ!' : date(
|
||||||
|
'G:i', $tournament['start_time']
|
||||||
|
);
|
||||||
|
$tournament_members_id = \Insallah\TournamentModel::getFreeFighters($tournament['tid']);
|
||||||
|
$members = [];
|
||||||
|
foreach ($tournament_members_id as $member) {
|
||||||
|
$members[] = \Insallah\TournamentModel::uidToLogin($member);
|
||||||
|
}
|
||||||
|
$tournaments .= sprintf(
|
||||||
|
"<li>Òóðíèð äëÿ %d óðîâíåé.<br>Âðåìÿ ïîäà÷è çàÿâêè: %s<br>Ó÷àñòíèêè: %s</li>",
|
||||||
|
$tournament['tid'], $time, implode(', ', $members)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
$tournaments .= '</ul>';
|
||||||
|
?>
|
||||||
|
<div>
|
||||||
|
<strong style="color: red;">Âíèìàíèå!</strong>
|
||||||
|
<ul>
|
||||||
|
<li style="color: blue;"> ñëó÷àå ñîçäàíèÿ ëèáî ïðèñîåäèíåíèÿ ê Òóðíèðó, ïîêèíóòü åãî -
|
||||||
|
<u>íåâîçìîæíî</u>!
|
||||||
|
</li>
|
||||||
|
<?php if (\Insallah\TournamentModel::isEkrOverpriced($this->u->info['id'])): ?>
|
||||||
|
<li>Ñòîèìîñòü ïðåäìåòîâ, îäåòûõ íà âàñ íå äîëæíà
|
||||||
|
ïðåâûøàòü <?= \Insallah\Tournament::ekrOverpriceFormula(
|
||||||
|
$this->u->info['level']
|
||||||
|
) ?> åâðîêðåäèòîâ.
|
||||||
|
</li>
|
||||||
|
<?php endif; ?>
|
||||||
|
<?php if ($this->u->info['exp'] < \Insallah\Tournament::MIN_EXP): ?>
|
||||||
|
<li>Ó âàñ äîëæíî áûòü íå ìåíåå <?= \Insallah\Tournament::MIN_EXP ?> îïûòà.</li>
|
||||||
|
<?php endif; ?>
|
||||||
|
<li style="color: blue;">Òóðíèð íà÷í¸òñÿ, êîãäà â çàÿâêå
|
||||||
|
íàáåð¸òñÿ <?= \Insallah\Tournament::START_TOURNAMENT ?> ÷åëîâåê.
|
||||||
|
</li>
|
||||||
|
<li style="color: blue;">Èãðîêè çàíÿâøèå 1, 2 è 3 ìåñòà ïîëó÷àò 25, 15, 5 Ðåëèêâèé
|
||||||
|
Àíãåëà, à òàê æå çàäåðæêè íà ó÷àñòèå â òóðíèðå 12 ÷àñîâ, 6 è 3 ÷àñà ñîîòâåòñòâåííî!
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<?php if (!empty($tournamentsList)): ?>
|
||||||
|
<div>
|
||||||
|
<strong>Àêòèâíûå òóðíèðû.</strong><br>
|
||||||
|
<?= $tournaments ?>
|
||||||
|
</div>
|
||||||
|
<?php endif; ?>
|
||||||
|
<?php if (!\Insallah\TournamentModel::getTournamentIdByUserId(
|
||||||
|
$this->u->info['id']
|
||||||
|
) || !\Insallah\TournamentModel::isStarted($this->u->info['level'])): ?>
|
||||||
|
<form method="post">
|
||||||
|
<input type="submit" name="tournament_start" value="Ïðèíÿòü ó÷àñòèå â òóðíèðå">
|
||||||
|
<input type="hidden" name="key" value="<?= $_SESSION['bypass'] ?>">
|
||||||
|
</form>
|
||||||
|
<?php else: ?>
|
||||||
|
Âû ó÷àâñòâóåòå.
|
||||||
|
<?php endif; ?>
|
||||||
|
<?php
|
||||||
|
} else {
|
||||||
|
?>
|
||||||
|
<div>
|
||||||
|
<strong style="color: crimson;">Â äàííûé ìîìåíò òóðíèðû íå ïðîâîäÿòñÿ!</strong>
|
||||||
|
</div>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
/** Êîíåö òóðíèðîâ îò Insallah. */
|
/** Êîíåö òóðíèðîâ îò Insallah. */
|
||||||
} elseif ($this->u->info['zv'] > 0 && $this->u->info['battle'] == 0 && $r != 8) {
|
} elseif ($this->u->info['zv'] > 0 && $this->u->info['battle'] == 0 && $r != 8) {
|
||||||
if ($zi['razdel'] == 1 || $zi['razdel'] == 2 || $zi['razdel'] == 3) {
|
if ($zi['razdel'] == 1 || $zi['razdel'] == 2 || $zi['razdel'] == 3) {
|
||||||
@ -2268,7 +2333,7 @@ function MM_jumpMenu(targ,selObj,restore){ //v3.0
|
|||||||
|
|
||||||
public function seeZv()
|
public function seeZv()
|
||||||
{
|
{
|
||||||
global $c, $code, $zi;
|
global $code, $zi;
|
||||||
if (isset($_GET['r']) && $this->zv_see == 1) {
|
if (isset($_GET['r']) && $this->zv_see == 1) {
|
||||||
$r = round(intval($_GET['r']));
|
$r = round(intval($_GET['r']));
|
||||||
if ($r >= 1 && $r <= 5) {
|
if ($r >= 1 && $r <= 5) {
|
||||||
@ -2592,7 +2657,7 @@ function MM_jumpMenu(targ,selObj,restore){ //v3.0
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
$d1 = '';
|
$d1 = '';
|
||||||
if ($uz['id'] == $this->u->info['id'] || $uze['id'] == $this->u->info['id'] || $this->u->info['level'] <= $c['bot_level']) {
|
if ($uz['id'] == $this->u->info['id'] || $uze['id'] == $this->u->info['id'] || $this->u->info['level'] <= Config::get('bot_level')) {
|
||||||
$d1 = 'disabled="disabled"';
|
$d1 = 'disabled="disabled"';
|
||||||
}
|
}
|
||||||
if (!isset($uze['id']) || $this->u->info['zv'] == $pl['id']) {
|
if (!isset($uze['id']) || $this->u->info['zv'] == $pl['id']) {
|
||||||
@ -2652,7 +2717,7 @@ function MM_jumpMenu(targ,selObj,restore){ //v3.0
|
|||||||
<input class="btn" style="margin-top:1px;" type="submit" value="Ïðèíÿòü ó÷àñòèå â ìÿñîðóáêå" /></form></div>';
|
<input class="btn" style="margin-top:1px;" type="submit" value="Ïðèíÿòü ó÷àñòèå â ìÿñîðóáêå" /></form></div>';
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if ($zvb != '' && $this->u->info['level'] > $c['bot_level']) {
|
if ($zvb != '' && $this->u->info['level'] > Config::get('bot_level')) {
|
||||||
echo '<div style="float:left;"><form method="post" style="margin:0px;padding:0px;" action="main.php?zayvka=1&r=' . $r . '&rnd=' . $code . '"><br><input class="btn" name="" type="submit" value="Ïðèíÿòü âûçîâ" /><br>' . $zvb . '<input class="btn" style="margin-top:1px;" type="submit" value="Ïðèíÿòü âûçîâ" /></form></div>';
|
echo '<div style="float:left;"><form method="post" style="margin:0px;padding:0px;" action="main.php?zayvka=1&r=' . $r . '&rnd=' . $code . '"><br><input class="btn" name="" type="submit" value="Ïðèíÿòü âûçîâ" /><br>' . $zvb . '<input class="btn" style="margin-top:1px;" type="submit" value="Ïðèíÿòü âûçîâ" /></form></div>';
|
||||||
} else {
|
} else {
|
||||||
echo '<div style="float:left;">' . $zvb . '</div>';
|
echo '<div style="float:left;">' . $zvb . '</div>';
|
||||||
|
@ -2,11 +2,14 @@
|
|||||||
|
|
||||||
namespace Insallah;
|
namespace Insallah;
|
||||||
|
|
||||||
|
use Core\Db;
|
||||||
|
use User;
|
||||||
|
|
||||||
class Achievements
|
class Achievements
|
||||||
{
|
{
|
||||||
private $user;
|
private User $user;
|
||||||
private $info;
|
private $info;
|
||||||
private $data = [
|
private array $data = [
|
||||||
'zb' => [
|
'zb' => [
|
||||||
'questname' => 'Åæåäí.Çàäàíèÿ',
|
'questname' => 'Åæåäí.Çàäàíèÿ',
|
||||||
'quest' => 'Âûïîëíèòü çàäàíèÿ áàáêè.',
|
'quest' => 'Âûïîëíèòü çàäàíèÿ áàáêè.',
|
||||||
@ -93,41 +96,51 @@ class Achievements
|
|||||||
],
|
],
|
||||||
];
|
];
|
||||||
|
|
||||||
public function __construct(\User $user)
|
public function __construct(User $user)
|
||||||
{
|
{
|
||||||
$this->user = $user;
|
$this->user = $user;
|
||||||
$this->info = Db::getRow('select * from users_achiv where id = ?', [$user->info['id']]);
|
$this->info = Db::getRow('select * from users_achiv where id = ?', [$user->info['id']]);
|
||||||
}
|
}
|
||||||
|
|
||||||
private function prizeName($int, $string)
|
//fixme: ñþäà èíîãäà ïðèõîäèò (NULL, NULL).
|
||||||
|
private function prizeName(?int $int, ?string $string): string
|
||||||
{
|
{
|
||||||
return in_array($string, ['åêð.', 'êð.']) ? $int . ' ' . $string : $string . ' ' . $int;
|
return in_array($string, ['åêð.', 'êð.']) ? $int . ' ' . $string : $string . ' ' . $int;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function drawSunduk($nagr, $whatInside, $tier)
|
private function drawSunduk($nagr, $whatInside, $tier): string
|
||||||
{
|
{
|
||||||
return vsprintf('<img onclick="%s" onmouseover="%s" onmouseout="%s" onmousedown="%s" class="cp" src="%s" alt="Ñóíäóê">',
|
return vsprintf(
|
||||||
|
'<img onclick="%s" onmouseover="%s" onmouseout="%s" onmousedown="%s" class="cp" src="%s" alt="Ñóíäóê">',
|
||||||
[
|
[
|
||||||
"location.href='\main.php?titul&nagr=$nagr'",
|
"location.href='\main.php?titul&nagr=$nagr'",
|
||||||
"top.hi(this, '<b>Ñóíäóê $tier ðàíãà<hr>Ñîäåðæèò:<hr> $whatInside</b>', event, 2, 0, 1, 1, 'max-width:307px')",
|
"top.hi(this, '<b>Ñóíäóê $tier ðàíãà<hr>Ñîäåðæèò:<hr> $whatInside</b>', event, 2, 0, 1, 1, 'max-width:307px')",
|
||||||
"top.hic();",
|
"top.hic();",
|
||||||
"top.hic();",
|
"top.hic();",
|
||||||
"https://img.new-combats.com/i/titul/nagr$tier.gif"
|
"https://img.new-combats.com/i/titul/nagr$tier.gif"
|
||||||
]);
|
]
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getList()
|
public function getList(): string
|
||||||
{
|
{
|
||||||
$string = '';
|
$string = '';
|
||||||
$this->calculateCurrent(1);
|
$this->calculateCurrent(1);
|
||||||
|
|
||||||
foreach ($this->data as $key => $value) {
|
foreach ($this->data as $key => $value) {
|
||||||
|
|
||||||
//Áëÿ, êàêóþ õåðíþ ïðèõîäèòñÿ ãîðîäèòü!
|
//Áëÿ, êàêóþ õåðíþ ïðèõîäèòñÿ ãîðîäèòü!
|
||||||
//Ïåðâîå ÷èñëî = òðåáîâàíèå ñëåäóþùåãî òèðà ìèíóñ òðåáîâàíèå òåêóùåãî òèðà (íàäî íàáðàòü)
|
//Ïåðâîå ÷èñëî = òðåáîâàíèå ñëåäóþùåãî òèðà ìèíóñ òðåáîâàíèå òåêóùåãî òèðà (íàäî íàáðàòü)
|
||||||
//Âòîðîå ÷èñëî = êîëè÷åñòâî äîñòèæåíèé ìèíóñ òðåáîâàíèå òåêóùåãî òèðà (íàáðàë)
|
//Âòîðîå ÷èñëî = êîëè÷åñòâî äîñòèæåíèé ìèíóñ òðåáîâàíèå òåêóùåãî òèðà (íàáðàë)
|
||||||
//Òðåáîâàíèÿ òåêóùåãî òèðà îòíèìàþòñÿ ÷òîáû êàæäûé òèð íà÷èíàë ñ÷èòàòü ïðîöåíò ñ 0.
|
//Òðåáîâàíèÿ òåêóùåãî òèðà îòíèìàþòñÿ ÷òîáû êàæäûé òèð íà÷èíàë ñ÷èòàòü ïðîöåíò ñ 0.
|
||||||
//Ïèçäû äàòü òîìó, êòî òàê óåáàíñêè íàçûâàåò ïåðåìåííûå, ÷òî íóæíî ïîëäíÿ âúåçæàòü ÷òî ïðîèñõîäèò.
|
//Ïèçäû äàòü òîìó, êòî òàê óåáàíñêè íàçûâàåò ïåðåìåííûå, ÷òî íóæíî ïîëäíÿ âúåçæàòü ÷òî ïðîèñõîäèò.
|
||||||
//È õåð ïîìåíÿåøü - âñ¸ ñëîìàåòñÿ. FFUUUUUUUUUUUUUU!!! Ins.
|
//È õåð ïîìåíÿåøü - âñ¸ ñëîìàåòñÿ. FFUUUUUUUUUUUUUU!!! Ins.
|
||||||
|
|
||||||
|
if (!is_numeric($value['check'][$this->info['klas' . $key]])) {
|
||||||
|
// Ïîòîìû ÷òî ïåðâûé ýëåìåíò ìàññèâà - ñëîâî. Â ÐÍÐ5.4 ïðîêàòûâàëî, â ÐÍÐ7.4 - íåò.
|
||||||
|
$value['check'][$this->info['klas' . $key]] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
$percentToSuccess = Math::get100Percentage(
|
$percentToSuccess = Math::get100Percentage(
|
||||||
$value['check'][$this->info['klas' . $key] + 1] - $value['check'][$this->info['klas' . $key]],
|
$value['check'][$this->info['klas' . $key] + 1] - $value['check'][$this->info['klas' . $key]],
|
||||||
$this->info[$key] - $value['check'][$this->info['klas' . $key]]
|
$this->info[$key] - $value['check'][$this->info['klas' . $key]]
|
||||||
@ -137,6 +150,7 @@ class Achievements
|
|||||||
$string .= '<strong>' . $value['quest'] . '</strong><br>';
|
$string .= '<strong>' . $value['quest'] . '</strong><br>';
|
||||||
$string .= 'Òåêóùèé Ðàíã: <strong>' . $this->info['klas' . $key] . '</strong> ';
|
$string .= 'Òåêóùèé Ðàíã: <strong>' . $this->info['klas' . $key] . '</strong> ';
|
||||||
$string .= 'Êîëè÷åñòâî ' . mb_strtolower($value['check'][0]) . ': <strong>' . $this->info[$key] . ' = ' . $percentToSuccess . '%</strong>';
|
$string .= 'Êîëè÷åñòâî ' . mb_strtolower($value['check'][0]) . ': <strong>' . $this->info[$key] . ' = ' . $percentToSuccess . '%</strong>';
|
||||||
|
//$string .= '<progress value="' . $percentToSuccess . '" max="100" style="accent-color:green; appearance: none;">' . $percentToSuccess . '</progress>';
|
||||||
|
|
||||||
$string .= Table::get([
|
$string .= Table::get([
|
||||||
['Ðàíãè', 1, 2, 3, 4, 5],
|
['Ðàíãè', 1, 2, 3, 4, 5],
|
||||||
@ -182,6 +196,10 @@ class Achievements
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (is_null($this->info[$k])) {
|
||||||
|
$this->info[$k] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
$this->info["klas$k"] = 0;
|
$this->info["klas$k"] = 0;
|
||||||
$this->info["name$k"] = $this->data[$k]['questname'];
|
$this->info["name$k"] = $this->data[$k]['questname'];
|
||||||
$this->info["klasP$k"] = Math::get100Percentage($this->data[$k]['check'][1], $this->info[$k]);
|
$this->info["klasP$k"] = Math::get100Percentage($this->data[$k]['check'][1], $this->info[$k]);
|
||||||
@ -203,10 +221,10 @@ class Achievements
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getInfo($user_id = null)
|
public function getInfo(?int $uid = null)
|
||||||
{
|
{
|
||||||
if (!is_null($user_id)) {
|
if (!is_null($uid)) {
|
||||||
$this->info = Db::getRow('select * from users_achiv where id = ?', [$user_id]);
|
$this->info = \Core\Db::getRow('select * from users_achiv where id = ?', [$uid]);
|
||||||
}
|
}
|
||||||
$this->calculateCurrent();
|
$this->calculateCurrent();
|
||||||
return $this->info;
|
return $this->info;
|
||||||
@ -220,7 +238,7 @@ class Achievements
|
|||||||
|
|
||||||
private function addOne($name)
|
private function addOne($name)
|
||||||
{
|
{
|
||||||
Db::sql("update users_achiv set $name = $name + 1 where id = ?", [$this->user->info['id']]);
|
\Core\Db::sql("update users_achiv set $name = $name + 1 where id = ?", [$this->user->info['id']]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function updateTier($name)
|
public function updateTier($name)
|
||||||
@ -240,12 +258,12 @@ class Achievements
|
|||||||
/**
|
/**
|
||||||
* @return array[]
|
* @return array[]
|
||||||
*/
|
*/
|
||||||
public function getData()
|
public function getData(): array
|
||||||
{
|
{
|
||||||
return $this->data;
|
return $this->data;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function hasNoTier4Access($nagr)
|
public function hasNoTier4Access($nagr): bool
|
||||||
{
|
{
|
||||||
return $this->user->info['level'] < 9 && in_array($nagr, [14, 15, 24, 25, 34, 35, 44, 45, 54, 55, 64, 65, 74, 75, 84, 85, 94, 95, 104, 105]);
|
return $this->user->info['level'] < 9 && in_array($nagr, [14, 15, 24, 25, 34, 35, 44, 45, 54, 55, 64, 65, 74, 75, 84, 85, 94, 95, 104, 105]);
|
||||||
}
|
}
|
||||||
@ -257,7 +275,7 @@ class Achievements
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getTypes()
|
public function getTypes(): array
|
||||||
{
|
{
|
||||||
return array_keys($this->data);
|
return array_keys($this->data);
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,16 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
//use Insallah\Tournament;
|
||||||
|
|
||||||
//require_once 'Core/Db.php';
|
//require_once 'Core/Db.php';
|
||||||
require_once 'Core/Math.php';
|
require_once 'Core/Math.php';
|
||||||
require_once 'Core/Table.php';
|
require_once 'Core/Table.php';
|
||||||
require_once 'Runes/Runes.php';
|
require_once 'Runes/Runes.php';
|
||||||
|
//require_once 'Tournament/Tournament.php';
|
||||||
|
//require_once 'Tournament/TournamentModel.php';
|
||||||
require_once 'Achievements.php';
|
require_once 'Achievements.php';
|
||||||
|
|
||||||
|
//Âìåñòî êðîíà äëÿ òóðíèðà.
|
||||||
|
//if (Tournament::IS_ENABLED) {
|
||||||
|
// (new Tournament())->startAllBattles();
|
||||||
|
//}
|
@ -2,14 +2,14 @@
|
|||||||
|
|
||||||
namespace Insallah;
|
namespace Insallah;
|
||||||
|
|
||||||
use Core\Database;
|
//use Core\Database;
|
||||||
use Exception;
|
use Exception;
|
||||||
use http\Message;
|
//use http\Message;
|
||||||
use PDO;
|
use PDO;
|
||||||
use PDOException;
|
use PDOException;
|
||||||
use PDOStatement;
|
use PDOStatement;
|
||||||
|
|
||||||
class Db
|
class DbOld
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Íàñòðîéêè ïîäêëþ÷åíèÿ
|
* Íàñòðîéêè ïîäêëþ÷åíèÿ
|
@ -5,19 +5,30 @@ namespace Insallah;
|
|||||||
/** All raw mathematics in one place. */
|
/** All raw mathematics in one place. */
|
||||||
class Math
|
class Math
|
||||||
{
|
{
|
||||||
public static function getPercentage($total, $number)
|
/**
|
||||||
|
* @param float|int $total
|
||||||
|
* @param int|null $number
|
||||||
|
* @return float
|
||||||
|
*/
|
||||||
|
public static function getPercentage($total, ?int $number): float
|
||||||
{
|
{
|
||||||
|
if (is_null($number)) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
return $total > 0 ? round(($number * 100) / $total, 2) : 0;
|
return $total > 0 ? round(($number * 100) / $total, 2) : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static function get100Percentage($total, $number)
|
public static function get100Percentage($total, ?int $number)
|
||||||
{
|
{
|
||||||
|
if (is_null($number)) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
return min(self::getPercentage($total, $number), 100);
|
return min(self::getPercentage($total, $number), 100);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Number-20% and Number+20% */
|
/** Number-20% and Number+20% */
|
||||||
public static function get20PercentRange($number)
|
public static function get20PercentRange($number): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'min' => $number * ((100 - 20) / 100),
|
'min' => $number * ((100 - 20) / 100),
|
||||||
|
37
_incl_data/class/Insallah/Math.php
Normal file
37
_incl_data/class/Insallah/Math.php
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Insallah;
|
||||||
|
|
||||||
|
/** All raw mathematics in one place. */
|
||||||
|
class Math
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @param float|int $total
|
||||||
|
* @param int|null $number
|
||||||
|
* @return float
|
||||||
|
*/
|
||||||
|
public static function getPercentage($total, int $number): float
|
||||||
|
{
|
||||||
|
return $total > 0 ? round(($number * 100) / $total, 2) : 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static function get100Percentage($total, int $number)
|
||||||
|
{
|
||||||
|
return min(self::getPercentage($total, $number), 100);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Number-20% and Number+20% */
|
||||||
|
public static function get20PercentRange($number): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'min' => $number * ((100 - 20) / 100),
|
||||||
|
'max' => $number * ((100 + 20) / 100),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function addPercent($num, $percent)
|
||||||
|
{
|
||||||
|
return $num + (($percent / 100) * $num);
|
||||||
|
}
|
||||||
|
}
|
22
_incl_data/class/Insallah/Table.php
Normal file
22
_incl_data/class/Insallah/Table.php
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Insallah;
|
||||||
|
|
||||||
|
class Table
|
||||||
|
{
|
||||||
|
public static function get($rows, $class = '', $fill = false)
|
||||||
|
{
|
||||||
|
$c = '';
|
||||||
|
$max_rows = sizeof(max($rows));
|
||||||
|
|
||||||
|
|
||||||
|
foreach ($rows as $row) {
|
||||||
|
if ($fill && sizeof($row) < $max_rows) {
|
||||||
|
$row = array_merge($row, array_fill(0, $max_rows - sizeof($row), ''));
|
||||||
|
}
|
||||||
|
$c .= '<tr><td>' . implode('</td><td>', $row) . '</td></tr>';
|
||||||
|
}
|
||||||
|
|
||||||
|
return (!empty($class) ? "<table class='$class'>" : '<table>') . $c . '</table>' . PHP_EOL;
|
||||||
|
}
|
||||||
|
}
|
141
_incl_data/class/Insallah/Tournament/Tournament.php
Normal file
141
_incl_data/class/Insallah/Tournament/Tournament.php
Normal file
@ -0,0 +1,141 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Insallah;
|
||||||
|
|
||||||
|
class Tournament
|
||||||
|
{
|
||||||
|
const IS_ENABLED = true;
|
||||||
|
private const SEND_CHAT_MESSAGE = 3;
|
||||||
|
private const START_TOURNAMENT = 5;
|
||||||
|
private const PRIZE1 = 25;
|
||||||
|
private const PRIZE2 = 10;
|
||||||
|
private const PRIZE3 = 5;
|
||||||
|
const MIN_EXP = 175000;
|
||||||
|
private const CHAT_MESSAGE = 'Âíèìàíèå! Òóðíèð äëÿ %d óðîâíÿ îòêðûò! Ïîñïåøèòå ïðèíÿòü ó÷àñòèå â Çàëå Âîèíîâ!';
|
||||||
|
private const VICTORY_MESSAGE = 'Òóðíèð äëÿ %d óðîâíåé çàâåðø¸í! Ïåðâîå ìåñòî: %s. Âòîðîå ìåñòî: %s. Òðåòüå ìåñòî: %s.';
|
||||||
|
private const DELAY1 = '+12hour';
|
||||||
|
private const DELAY2 = '+6hour';
|
||||||
|
private const DELAY3 = '+3hour';
|
||||||
|
|
||||||
|
/** Ôîðìóëà ðàññ÷¸òà ðàçðåø¸ííîé ñòîèìîñòè îäåòûõ ïðåäìåòîâ.
|
||||||
|
*
|
||||||
|
* @param int $int
|
||||||
|
*
|
||||||
|
* @return float|int
|
||||||
|
*/
|
||||||
|
public static function ekrOverpriceFormula(int $int): int
|
||||||
|
{
|
||||||
|
return ($int - 7) * 151;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ïðîâåðÿåì ìîæåò ëè èãðîê ó÷àâñòâîâàòü â òóðíèðå è ëèáî ïðèñîåäèíÿåì åãî, ëèáî îáëàìûâàåì.
|
||||||
|
*
|
||||||
|
* @param int $uid
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function join(int $uid): void
|
||||||
|
{
|
||||||
|
/** Âîçâðàùàåò level, èëè 0 åñëè ïðîâàëåíû ïðîâåðêè. */
|
||||||
|
$userLevel = TournamentModel::getUserLevel($uid);
|
||||||
|
if (
|
||||||
|
$userLevel === 0 ||
|
||||||
|
TournamentModel::isEkrOverpriced($uid, $userLevel) ||
|
||||||
|
!TournamentModel::isEnoughExperience($uid) ||
|
||||||
|
TournamentModel::isRestrictedToJoin($uid) ||
|
||||||
|
TournamentModel::isStarted($uid)
|
||||||
|
) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$mq = TournamentModel::getWaitingMembersQuantity($userLevel);
|
||||||
|
if (empty($mq)) {
|
||||||
|
TournamentModel::createTournament($userLevel);
|
||||||
|
}
|
||||||
|
|
||||||
|
TournamentModel::joinTournament($uid, $userLevel);
|
||||||
|
$mq++;
|
||||||
|
|
||||||
|
if ($mq == self::SEND_CHAT_MESSAGE) {
|
||||||
|
TournamentModel::sysMessage(sprintf(self::CHAT_MESSAGE, $userLevel));
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($mq == self::START_TOURNAMENT) {
|
||||||
|
TournamentModel::startTournament($userLevel);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ïðîâåðêà äëÿ êðîíà\êîíôèãà. Âûáèâàåò ïðîèãðàâøèõ è ïåðåçàïóñêàåò ïîåäèíêè âî âñåõ òóðíèðàõ.
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function startAllBattles(): void
|
||||||
|
{
|
||||||
|
$db = new Db();
|
||||||
|
$db::sql(
|
||||||
|
'delete from tournaments where start_time + date_add(start_time,interval 30 minute) < unix_timestamp()'
|
||||||
|
);
|
||||||
|
TournamentModel::removeFighter(TournamentModel::getLooser());
|
||||||
|
$tournamentLevels = $db::getColumn('select tid from tournaments where start_time = -1');
|
||||||
|
foreach ($tournamentLevels as $level) {
|
||||||
|
$aliveFighters = TournamentModel::getFreeFighters($level);
|
||||||
|
if (count($aliveFighters) > 1) {
|
||||||
|
shuffle($aliveFighters);
|
||||||
|
$this->startBattle($aliveFighters);
|
||||||
|
} elseif (count($aliveFighters) === 1) {
|
||||||
|
TournamentModel::removeFighter($aliveFighters[0], true);
|
||||||
|
$this->victory($level);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ïîëó÷àåì ïàðû áîéöîâ è íà÷èíàåì èõ ïîåäèíêè.
|
||||||
|
*
|
||||||
|
* @param array $fightersList
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
private function startBattle(array $fightersList): void
|
||||||
|
{
|
||||||
|
$teams = TournamentModel::getFightersTeams($fightersList);
|
||||||
|
foreach ($teams as $team) {
|
||||||
|
if (count($team) === 2) {
|
||||||
|
TournamentModel::startBattle($team[0], $team[1]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Íàãðàæäàåì ïîáåäèòåëåé òóðíèðà, ÷èñòèì áàçó.
|
||||||
|
*
|
||||||
|
* @param int $tid
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
private function victory(int $tid): void
|
||||||
|
{
|
||||||
|
$winners = TournamentModel::getWinners($tid);
|
||||||
|
sleep(1);
|
||||||
|
TournamentModel::givePrizeItems($winners[1], self::PRIZE1);
|
||||||
|
TournamentModel::givePrizeItems($winners[2], self::PRIZE2);
|
||||||
|
TournamentModel::givePrizeItems($winners[3], self::PRIZE3);
|
||||||
|
sleep(1);
|
||||||
|
TournamentModel::giveDelay($winners[1], strtotime(self::DELAY1));
|
||||||
|
TournamentModel::giveDelay($winners[2], strtotime(self::DELAY2));
|
||||||
|
TournamentModel::giveDelay($winners[3], strtotime(self::DELAY3));
|
||||||
|
sleep(1);
|
||||||
|
TournamentModel::sysMessage(
|
||||||
|
sprintf(
|
||||||
|
self::VICTORY_MESSAGE,
|
||||||
|
$tid,
|
||||||
|
TournamentModel::uidToLogin($winners[1]),
|
||||||
|
TournamentModel::uidToLogin($winners[2]),
|
||||||
|
TournamentModel::uidToLogin($winners[3])
|
||||||
|
)
|
||||||
|
);
|
||||||
|
sleep(3);
|
||||||
|
TournamentModel::destroyTournament($tid);
|
||||||
|
}
|
||||||
|
}
|
358
_incl_data/class/Insallah/Tournament/TournamentModel.php
Normal file
358
_incl_data/class/Insallah/Tournament/TournamentModel.php
Normal file
@ -0,0 +1,358 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Insallah;
|
||||||
|
|
||||||
|
class TournamentModel
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ïðîâåðêà óðîâíÿ, ñòîèìîñòè ýêâèïà, ïðî÷èå ïðîâåðêè, ÷òî ïåðñîíàæ ñâîáîäåí
|
||||||
|
* òàéìåð îæèäàíèÿ 30 ìèíóò
|
||||||
|
*
|
||||||
|
* @param int $uid
|
||||||
|
*
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
|
public static function getUserLevel(int $uid): int
|
||||||
|
{
|
||||||
|
$db = new Db();
|
||||||
|
$level = $db::getValue('select level from users where id = ? and level between 8 and 12 and battle = 0', [$uid]);
|
||||||
|
return $level ?: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param int $uid
|
||||||
|
* @param int|null $level
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public static function isEkrOverpriced(int $uid, ?int $level = null): bool
|
||||||
|
{
|
||||||
|
$db = new Db();
|
||||||
|
if (is_null($level)) {
|
||||||
|
$level = $db::getValue('select level from users where id = ?', [$uid]);
|
||||||
|
}
|
||||||
|
$wearedItemsEkrPrice = $db::getValue('select sum(2price) from items_users where inOdet > 0 and uid = ?', [$uid]);
|
||||||
|
return $wearedItemsEkrPrice > Tournament::ekrOverpriceFormula($level);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param int $uid
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public static function isEnoughExperience(int $uid): bool
|
||||||
|
{
|
||||||
|
$db = new Db();
|
||||||
|
return $db::getValue('select exp from stats where id = ?', [$uid]) >= Tournament::MIN_EXP;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param int $uid
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public static function isRestrictedToJoin(int $uid): bool
|
||||||
|
{
|
||||||
|
$db = new Db();
|
||||||
|
return $db::getValue('select count(*) from eff_users where uid = ? and id_eff = 486 and `delete` = 0', [$uid]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param int $tid
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public static function isStarted(int $tid): bool
|
||||||
|
{
|
||||||
|
$db = new Db();
|
||||||
|
return $db::getValue('select count(*) from tournaments where start_time = -1 and tid = ?', [$tid]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ñ÷èòàåì ñêîëüêî èãðîêîâ æäóò â çàÿâêå íà òóðíèð.
|
||||||
|
*
|
||||||
|
* @param int $tid
|
||||||
|
*
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
|
public static function getWaitingMembersQuantity(int $tid): int
|
||||||
|
{
|
||||||
|
$db = new Db();
|
||||||
|
return $db::getValue('select count(*) from tournaments_users where tid = ?', [$tid]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ñîçäàíèå íîâîãî òóðíèðà.
|
||||||
|
*
|
||||||
|
* @param int $tid
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public static function createTournament(int $tid): void
|
||||||
|
{
|
||||||
|
$db = new Db();
|
||||||
|
$db::sql('insert into tournaments (tid) values (?)', [$tid]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Èãðîê ïðèñîåäèíÿåòñÿ ê òóðíèðó è òåëåïîðòèðóåòñÿ â òóðíèðíóþ êîìíàòó.
|
||||||
|
*
|
||||||
|
* @param int $uid
|
||||||
|
* @param int $tid
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public static function joinTournament(int $uid, int $tid): void
|
||||||
|
{
|
||||||
|
/** Êàñòîìíûå êîìíàòû 25008 - 25012. */
|
||||||
|
$roomId = 25000 + $tid;
|
||||||
|
$db = new Db();
|
||||||
|
$db::sql('insert into tournaments_users (tid, uid) values (?, ?)', [$tid, $uid]);
|
||||||
|
self::teleport($uid, $roomId);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ñòàðò òóðíèðà.
|
||||||
|
*
|
||||||
|
* @param int $tid
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public static function startTournament(int $tid): void
|
||||||
|
{
|
||||||
|
$db = new Db();
|
||||||
|
$db::sql('update tournaments set start_time = -1 where tid = ?', [$tid]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ×èñòèì áàçû îò ïðîøåäøåãî òóðíèðà.
|
||||||
|
*
|
||||||
|
* @param int $tid
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public static function destroyTournament(int $tid): void
|
||||||
|
{
|
||||||
|
$db = new Db();
|
||||||
|
//Óáåäèòüñÿ ÷òî â áàçå íàñòðîåí foreign_keys è ïîñëåäóåò àâòîî÷èñòêà tournaments_users !!!
|
||||||
|
$db::sql('delete from tournaments where tid = ?', [$tid]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ïîëó÷àåì ñïèñîê áîéöîâ è áü¸ì èõ íà ïàðû. Âîçâðàùàåì ñïèñêè ïàð + 1 ïîñëåäíèé áåç ïàðû åñëè åñòü.
|
||||||
|
*
|
||||||
|
* @param array $fightersList
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public static function getFightersTeams(array $fightersList): array
|
||||||
|
{
|
||||||
|
$db = new Db();
|
||||||
|
$query = sprintf("select id from users where battle = 0 and id in (%s)", implode(', ', $fightersList));
|
||||||
|
return array_chunk($db::getColumn($query), 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Âûáèðàåì æèâûõ áîéöîâ íå ñðàæàþùèõñÿ â äàííûé ìîìåíò.
|
||||||
|
*
|
||||||
|
* @param int $tid
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public static function getFreeFighters(int $tid): array
|
||||||
|
{
|
||||||
|
$db = new Db();
|
||||||
|
return $db::getColumn('select uid from tournaments_users where tid = ? and death_time = 0 order by uid', [$tid]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Âûáèðàåì ïîáåäèòåëåé. Ñìåùàåì ìàññèâ, ÷òîáû âîçâðàò ø¸ë ñ åäèíèöû.
|
||||||
|
*
|
||||||
|
* @param int $tid
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public static function getWinners(int $tid): array
|
||||||
|
{
|
||||||
|
$db = new Db();
|
||||||
|
$winners = $db::getColumn('select uid from tournaments_users where tid = ? order by death_time desc limit 3', [$tid]);
|
||||||
|
return [
|
||||||
|
1 => $winners[0],
|
||||||
|
2 => $winners[1],
|
||||||
|
3 => $winners[2]
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ïðîáóåì âûêóñèòü ïðîèãðàâøåãî â ïîñëåäíåé òóðíèðíîé áèòâå è óäàëèòü ýòó ñàìóþ áèòâó âî èçáåæàíèå.
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public static function getLooser()
|
||||||
|
{
|
||||||
|
$query = '
|
||||||
|
select uid, battle
|
||||||
|
from
|
||||||
|
battle_users,
|
||||||
|
(select id, team_win
|
||||||
|
from battle
|
||||||
|
where
|
||||||
|
team_win > 0 and
|
||||||
|
typeBattle = 25000
|
||||||
|
order by time_over desc
|
||||||
|
limit 1) as last_battle
|
||||||
|
where
|
||||||
|
battle_users.battle = last_battle.id and
|
||||||
|
battle_users.team != last_battle.team_win and
|
||||||
|
battle_users.uid in (select uid from tournaments_users where death_time = 0)';
|
||||||
|
|
||||||
|
$query2 = 'select bu.uid from battle b
|
||||||
|
inner join battle_users bu on b.team_win != bu.team and b.id = bu.battle
|
||||||
|
inner join tournaments_users tu on bu.uid = tu.uid
|
||||||
|
where typeBattle = 25000 and death_time = 0 order by b.time_start desc limit 1';
|
||||||
|
$db = new Db;
|
||||||
|
$row = $db::getRow($query);
|
||||||
|
return $row['uid'] ?? 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Âûáûâøèé èç òóðíèðà ïîêèäàåò êîìíàòó è ïîëó÷àåò âðåìÿ ñìåðòè.
|
||||||
|
*
|
||||||
|
* @param int $uid
|
||||||
|
* @param bool $winner
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public static function removeFighter(int $uid, bool $winner = false): void
|
||||||
|
{
|
||||||
|
if (!$uid) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
//$winner_timer_add = $winner? 500 : 0; # Ïîñëåäíûé ÄÎËÆÅÍ áûòü ïîñëåäíèì.
|
||||||
|
$db = new Db();
|
||||||
|
$db::sql('update tournaments_users set death_time = unix_timestamp() + 500 where death_time = 0 and uid = ?', [$uid]);
|
||||||
|
self::teleport($uid, 9);
|
||||||
|
//fixme: Êëàññû íå ïîäêëþ÷àþòñÿ äðóã ê äðóãó. Íóæíî ìåíÿòü àðõèòåêòóðó èãðû. :(
|
||||||
|
Db::sql("update users_achiv set trn = trn + 1 where id = ?", [$uid]);
|
||||||
|
//(new Achievements(\user::start()))->updateCounter('trn');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Óçíà¸ì id òóðíèðà ïî id èãðîêà.
|
||||||
|
*
|
||||||
|
* @param int $uid
|
||||||
|
*
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public static function getTournamentIdByUserId(int $uid)
|
||||||
|
{
|
||||||
|
$db = new Db();
|
||||||
|
return $db::getValue('select tid from tournaments_users where uid = ?', [$uid]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ïîïðîáóåì ñòàðòîíóòü ïîåäèíîê.
|
||||||
|
* 25000 - Óíèêàëüíûé id ïîåäèíêà ïîä òóðíèðû.
|
||||||
|
* noinc - çàïðåò íà âìåøàòåëüñòâî
|
||||||
|
* invis - íåâèäèìûé áîé
|
||||||
|
*
|
||||||
|
* @param int $uid1
|
||||||
|
* @param int $uid2
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public static function startBattle(int $uid1, int $uid2): void
|
||||||
|
{
|
||||||
|
$db = new Db();
|
||||||
|
$check = Db::getValue('select count(*) from users where id in (?, ?) and battle = 0', [$uid1, $uid2]);
|
||||||
|
if ($check !== 2) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$db::exec('insert into battle (city, time_start, timeout, type, invis, noinc, travmChance, typeBattle)
|
||||||
|
values (\'capitalcity\', unix_timestamp(), 60, 0, 1, 1, 0, 25000)');
|
||||||
|
$bid = $db::lastInsertId(); // ÂÀÆÍÎ!
|
||||||
|
$db::sql('update stats set team = 1, hpNow = hpAll, mpNow = mpAll where id = ?', [$uid1]);
|
||||||
|
$db::sql('update stats set team = 2, hpNow = hpAll, mpNow = mpAll where id = ?', [$uid2]);
|
||||||
|
$db::sql('update users set battle = ? where id in (?, ?)', [$bid, $uid1, $uid2]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Óçíà¸ì ëîãèí ïåðñîíàæà ïî åãî id.
|
||||||
|
*
|
||||||
|
* @param int $uid
|
||||||
|
*
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public static function uidToLogin(int $uid)
|
||||||
|
{
|
||||||
|
$db = new Db();
|
||||||
|
return $db::getValue('select login from users where id = ?', [$uid]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Òåëåïîðò ïî êîìíàòàì.
|
||||||
|
*
|
||||||
|
* @param int $uid
|
||||||
|
* @param int $roomId
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
private static function teleport(int $uid, int $roomId): void
|
||||||
|
{
|
||||||
|
$db = new Db();
|
||||||
|
$db::sql('update users set room = ? where id = ?', [$roomId, $uid]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Íåò ïðîâåðîê $message ïîòîìó ÷òî îíî âñåãäà çàäà¸òñÿ â êîäå è èãðîê íà íåãî íå âëèÿåò.
|
||||||
|
*
|
||||||
|
* @param string $message
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public static function sysMessage(string $message): void
|
||||||
|
{
|
||||||
|
if (!empty($message)) {
|
||||||
|
$db = new Db();
|
||||||
|
$message = "<span style='font-weight: bold; color: forestgreen;'>$message</span>";
|
||||||
|
$db::sql('insert into chat (time, type, text, new, da) values (unix_timestamp(), 6, ?, 1, 1)', [$message]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ãåíåðèðóåò ìíîæåñòâåííûé çàïðîñ ñðàçó íà $quantity îäíîòèïíûõ ïðåäìåòîâ â èíâåíòàðü ïîëüçîâàòåëÿ $uid.
|
||||||
|
*
|
||||||
|
* @param int $uid
|
||||||
|
* @param int $quantity
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public static function givePrizeItems(int $uid, int $quantity): void
|
||||||
|
{
|
||||||
|
$query = 'insert into items_users (item_id, uid, data, iznosMAX, lastUPD, time_create)
|
||||||
|
values (4754, :uid, :data, 1, unix_timestamp(), unix_timestamp())';
|
||||||
|
$args = [
|
||||||
|
'uid' => $uid,
|
||||||
|
'data' => 'nosale=1|musor=1|sudba=' . self::uidToLogin($uid) . '|lvl=8|tr_s1=0|tr_s2=0|tr_s3=0|tr_s4=0'
|
||||||
|
];
|
||||||
|
$db = new Db();
|
||||||
|
$stmt = $db::prepare($query);
|
||||||
|
for ($i = 0; $i < $quantity; $i++) {
|
||||||
|
$stmt->execute($args);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Ýôôåêò-îãðàíè÷èòåëü íà ó÷àñòèå â òóðíèðå.
|
||||||
|
* @param int $uid
|
||||||
|
* @param int $unixtime
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public static function giveDelay(int $uid, int $unixtime): void
|
||||||
|
{
|
||||||
|
$db = new Db();
|
||||||
|
$query = 'insert into eff_users (id_eff, uid, name, timeUse) VALUES (?,?,?,?)';
|
||||||
|
$args = [486, $uid, 'Ïðèç¸ð ãîðîäñêîãî òóðíèðà!', $unixtime];
|
||||||
|
$db::sql($query, $args);
|
||||||
|
}
|
||||||
|
}
|
@ -31,11 +31,9 @@ class TList
|
|||||||
$this->str .= '<li>Ó âàñ äîëæíî áûòü íå ìåíåå ' . Config::MIN_EXP . ' îïûòà.</li>';
|
$this->str .= '<li>Ó âàñ äîëæíî áûòü íå ìåíåå ' . Config::MIN_EXP . ' îïûòà.</li>';
|
||||||
}
|
}
|
||||||
$this->str .= '<li>Òóðíèð íà÷í¸òñÿ, êîãäà â çàÿâêå
|
$this->str .= '<li>Òóðíèð íà÷í¸òñÿ, êîãäà â çàÿâêå
|
||||||
íàáåð¸òñÿ ' . Config::START_TOURNAMENT . ' ÷åëîâåê.</li>';
|
íàáåð¸òñÿ ' . Config::START_TOURNAMENT . ' ÷åëîâåê.</li>
|
||||||
$this->str .= '<li>Èãðîêè çàíÿâøèå 1, 2 è 3 ìåñòà ïîëó÷àò ' . Config::PRIZE1 . ', ' . Config::PRIZE2 . ',
|
</ul>
|
||||||
' . Config::PRIZE3 . ' Ðåëèêâèé Àíãåëà, à òàê æå çàäåðæêè íà ó÷àñòèå â òóðíèðå
|
</div>';
|
||||||
12 ÷àñîâ, 6 è 3 ÷àñà ñîîòâåòñòâåííî!</li>';
|
|
||||||
$this->str .= '</ul></div>';
|
|
||||||
$this->str .= $tournamentstatus->getList();
|
$this->str .= $tournamentstatus->getList();
|
||||||
if (!User::getTournamentIdByUserId($user->info['id']) || !$tournamentstatus->isStarted($user->info['level'])) {
|
if (!User::getTournamentIdByUserId($user->info['id']) || !$tournamentstatus->isStarted($user->info['level'])) {
|
||||||
$this->str .= '<form method="post">
|
$this->str .= '<form method="post">
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
use Insallah\Db;
|
use Core\Db;
|
||||||
|
|
||||||
class Learming
|
class Learming
|
||||||
{
|
{
|
||||||
|
@ -1604,7 +1604,7 @@ class Magic
|
|||||||
|
|
||||||
private static function getDressedEkrTotalPrice($uid)
|
private static function getDressedEkrTotalPrice($uid)
|
||||||
{
|
{
|
||||||
return \Insallah\Db::getValue('select sum(2price) from items_users where inOdet > 0 and uid = ?', [$uid]);
|
return \Core\Db::getValue('select sum(2price) from items_users where inOdet > 0 and uid = ?', [$uid]);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static function canAttack8Level($attacker, $target)
|
private static function canAttack8Level($attacker, $target)
|
||||||
|
17
_incl_data/class/PassGen.php
Normal file
17
_incl_data/class/PassGen.php
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
class PassGen
|
||||||
|
{
|
||||||
|
public static function new($length = 8)
|
||||||
|
{
|
||||||
|
return substr(
|
||||||
|
preg_replace(
|
||||||
|
"/[^a-zA-Z0-9]/",
|
||||||
|
"",
|
||||||
|
base64_encode(openssl_random_pseudo_bytes($length + 1))
|
||||||
|
),
|
||||||
|
0,
|
||||||
|
$length
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
use Insallah\Db;
|
use Core\Db;
|
||||||
use Insallah\Math;
|
use Insallah\Math;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
use Insallah\Db;
|
use Core\Db;
|
||||||
|
|
||||||
class Season
|
class Season
|
||||||
{
|
{
|
||||||
|
@ -1,14 +1,13 @@
|
|||||||
<?php
|
<?php
|
||||||
if (!defined('GAME')) {
|
|
||||||
die();
|
use Core\Db;
|
||||||
}
|
|
||||||
|
|
||||||
class Tournir
|
class Tournir
|
||||||
{
|
{
|
||||||
private $u;
|
private User $u;
|
||||||
private $info;
|
private array $info;
|
||||||
private $user;
|
private array $user;
|
||||||
private $name = [0 => 'Âûæèòü ëþáîé öåíîé', 1 => 'Êàæäûé ñàì çà ñåáÿ', 2 => 'Çàõâàò êëþ÷à',];
|
private array $name = [0 => 'Âûæèòü ëþáîé öåíîé', 1 => 'Êàæäûé ñàì çà ñåáÿ', 2 => 'Çàõâàò êëþ÷à',];
|
||||||
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
@ -19,24 +18,24 @@ class Tournir
|
|||||||
|
|
||||||
private function start()
|
private function start()
|
||||||
{
|
{
|
||||||
$this->info = mysql_fetch_array(mysql_query('SELECT * FROM `turnirs` WHERE `id` = "' . $this->u->info['inTurnirnew'] . '" LIMIT 1'));
|
$this->info = Db::getRow('select * from turnirs where id = ?', [$this->u->info['inTurnirnew']]);
|
||||||
$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->user = Db::getRow('select * from users_turnirs where turnir = ? and bot = ?', [$this->u->info['inTurnirnew'], $this->u->info['id']]);
|
||||||
}
|
}
|
||||||
|
|
||||||
private function startTurnir()
|
private function startTurnir()
|
||||||
{
|
{
|
||||||
$row = mysql_fetch_array(mysql_query('SELECT COUNT(*) FROM `users` WHERE `win` = "0" AND `lose` = "0" AND `nich` = "0"'));
|
$row = Db::getValue('select count(*) from users where win = 0 and lose = 0 and nich = 0');
|
||||||
if ($row[0] <= 0 || $this->info['status'] == 3) {
|
if (!$row || $this->info['status'] == 3) {
|
||||||
if ($this->info['status'] == 3) {
|
if ($this->info['status'] == 3) {
|
||||||
$this->finishTurnir();
|
$this->finishTurnir();
|
||||||
}
|
}
|
||||||
} else {
|
} 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'] . '")');
|
Db::sql('insert into battle (city, time_start, timeout, type, turnir) values (?,unix_timestamp(),60,1,?)', [$this->u->info['city'], $this->info['id']]);
|
||||||
$uri = mysql_insert_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('Ïåðåéòèäå â ðàçäåë "ïîåäèíêè"...');
|
die('Ïåðåéòèäå â ðàçäåë "ïîåäèíêè"...');
|
||||||
}
|
}
|
||||||
@ -62,9 +61,6 @@ class Tournir
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($pl['team'] == $this->info['winner'] && $this->info['winner'] != 0) {
|
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];
|
$inf['add_expp'] = [0, 1, 5, 10, 15, 25, 35, 70, 100, 150, 200, 300, 500, 700, 1000];
|
||||||
|
|
||||||
//ïîëó÷àåì îïûò (ñ 0 ïî 12 ëâë)
|
//ïîëó÷àåì îïûò (ñ 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');
|
mysql_query('UPDATE `users` SET `lose` = `lose` + 1,`lose_t` = `lose_t` + 1 WHERE `id` = "' . $inf['id'] . '" LIMIT 1');
|
||||||
|
|
||||||
$lose .= '<b>' . $inf['login'] . '</b>, ';
|
$lose .= '<b>' . $inf['login'] . '</b>, ';
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
mysql_query('UPDATE `users` SET `nich` = `nich` + 1 WHERE `id` = "' . $inf['id'] . '" LIMIT 1');
|
mysql_query('UPDATE `users` SET `nich` = `nich` + 1 WHERE `id` = "' . $inf['id'] . '" LIMIT 1');
|
||||||
}
|
}
|
||||||
@ -172,7 +167,6 @@ class Tournir
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($addi == 1) {
|
if ($addi == 1) {
|
||||||
|
|
||||||
$i = 0;
|
$i = 0;
|
||||||
while ($i <= 17) {
|
while ($i <= 17) {
|
||||||
if ($i == 10) {
|
if ($i == 10) {
|
||||||
@ -468,7 +462,6 @@ class Tournir
|
|||||||
}
|
}
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
$r .= '<div align="left" style="height:1px; width:100%; margin:10px 0 10px 0; border-top:1px solid #999999;"></div>';
|
$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">
|
$r .= '<table style="border:1px solid #99cccc" width="700" bgcolor="#bbdddd" border="0" align="center" cellpadding="5" cellspacing="0">
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -1,28 +1,116 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
use Core\Db;
|
||||||
|
|
||||||
class UserRegister
|
class UserRegister
|
||||||
{
|
{
|
||||||
|
|
||||||
public function __construct()
|
public function hasMixedLatCur(string $txt): bool
|
||||||
{
|
{
|
||||||
if (!empty($_SERVER['HTTP_CLIENT_IP'])) {
|
$en = preg_match("/^(([0-9A-z -])+)$/i", $txt);
|
||||||
$ip = $_SERVER['HTTP_CLIENT_IP'];
|
|
||||||
} elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
|
|
||||||
$ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
|
|
||||||
} else {
|
|
||||||
$ip = $_SERVER['REMOTE_ADDR'];
|
|
||||||
}
|
|
||||||
define('IP', $ip);
|
|
||||||
if ($_SERVER['HTTP_REFERER'] == 'https://new-combats.com/' && $_COOKIE['acomb1'] != '2') {
|
|
||||||
setcookie('acomb1', '1', time() + 60 * 60 * 24 * 3);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public function en_ru($txt)
|
|
||||||
{
|
|
||||||
$en = preg_match("/^(([0-9A-z _-])+)$/i", $txt);
|
|
||||||
$ru = preg_match("/^(([0-9À-ÿ _-])+)$/i", $txt);
|
$ru = preg_match("/^(([0-9À-ÿ _-])+)$/i", $txt);
|
||||||
return ($ru && $en) || (!$ru && !$en);
|
return ($ru && $en) || (!$ru && !$en);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function hasGoodLogin(string $login): string
|
||||||
|
{
|
||||||
|
$isRestricted = in_array(
|
||||||
|
$login,
|
||||||
|
[
|
||||||
|
'àíãåë', 'angel', 'àäìèíèñòðàöèÿ', 'administration', 'Êîììåíòàòîð',
|
||||||
|
'Ìèðîçäàòåëü', 'Ìóñîðùèê', 'Ïàäàëüùèê', 'Ïîâåëèòåëü',
|
||||||
|
'Àðõèâàðèóñ', 'Ïåðåñìåøíèê', 'Âîëûíùèê', 'Ëîðä Ðàçðóøèòåëü',
|
||||||
|
'Ìèëîñåðäèå', 'Ñïðàâåäëèâîñòü', 'Èñêóøåíèå', 'Âîçíåñåíèå',
|
||||||
|
]
|
||||||
|
);
|
||||||
|
$isRegistered = Db::getValue('select count(*) from users where login = ?', [$login]);
|
||||||
|
//Áûâøèå â óïîòðåáëåíèè ëîãèíû. Äè÷ü, íî ëàäíî.
|
||||||
|
$wasRegistered = Db::getValue('select count(*) from lastnames where login = ?', [$login]);
|
||||||
|
|
||||||
|
$login = str_replace(' ', ' ', $login);
|
||||||
|
//Ëîãèí îò 4 äî 20 ñèìâîëîâ
|
||||||
|
if (strlen($login) > 20) {
|
||||||
|
$error = 'Ëîãèí äîëæåí ñîäåðæàòü íå áîëåå 20 ñèìâîëîâ.';
|
||||||
|
}
|
||||||
|
if (strlen($login) < 4) {
|
||||||
|
$error = 'Ëîãèí äîëæåí ñîäåðæàòü íå ìåíåå 4 ñèìâîëîâ.';
|
||||||
|
}
|
||||||
|
if ($this->hasMixedLatCur($login)) {
|
||||||
|
$error = 'Â ëîãèíå ðàçðåøåíî èñïîëüçîâàòü òîëüêî áóêâû îäíîãî àëôàâèòà ðóññêîãî èëè àíãëèéñêîãî. Íåëüçÿ ñìåøèâàòü.';
|
||||||
|
}
|
||||||
|
//Ðàçäåëèòåëè
|
||||||
|
if (substr_count($login, ' ') + substr_count($login, '-') + substr_count($login, '_') > 2) {
|
||||||
|
$error = 'Íå áîëåå äâóõ ðàçäåëèòåëåé îäíîâðåìåííî (ïðîáåë, òèðå, íèæíåå ïîä÷åðêèâàíèå).';
|
||||||
|
}
|
||||||
|
if (!empty($error)) {
|
||||||
|
$error .= '<br> Ïðèìåð ïðàâèëüíîãî íèêíåéìà: Ïåòÿ Óáèâàòîð, Êîëÿ, xalop. <br> Ïðèìåð íåïðàâèëüíîãî íèêíåéìà: )))), kolÿ)=-/.';
|
||||||
|
|
||||||
|
}
|
||||||
|
if ($isRegistered || $wasRegistered || $isRestricted) {
|
||||||
|
$error = 'Ëîãèí ' . $login . ' óæå çàíÿò, âûáåðèòå äðóãîé.';
|
||||||
|
}
|
||||||
|
|
||||||
|
return $error ?? '';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function hasGoodEmail(string $email): string
|
||||||
|
{
|
||||||
|
$isRegistered = Db::getValue('select count(*) from users where mail = ?', [$email]);
|
||||||
|
$isBlocked = Db::getValue('select count(*) from ban_email where email = ?', [$email]);
|
||||||
|
if (!filter_var($email, FILTER_VALIDATE_EMAIL) || $isRegistered) {
|
||||||
|
$error = 'Íåïðàâèëüíûé email.';
|
||||||
|
}
|
||||||
|
if ($isBlocked) {
|
||||||
|
$error = 'Àäðåñ çàáëîêèðîâàí.';
|
||||||
|
}
|
||||||
|
|
||||||
|
$allowedDomains = Db::getColumn('select email from trust_email');
|
||||||
|
$domain = explode('@', $email)[1];
|
||||||
|
|
||||||
|
if (!in_array($domain, $allowedDomains)) {
|
||||||
|
$error = 'Äàííûé ïî÷òîâûé ñåðâèñ èñïîëüçîâàòü íåëüçÿ.';
|
||||||
|
}
|
||||||
|
|
||||||
|
return $error ?? '';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function hasGoodEmailCode(string $email, int $code): string
|
||||||
|
{
|
||||||
|
$check = Db::getValue('select code from secure_code where email = ?', [$email]);
|
||||||
|
if ($code !== $check) {
|
||||||
|
return 'Íåâåðíûé ïðîâåðî÷íûé êîä.';
|
||||||
|
}
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function hasGoodPassword(string $password1, string $password2): string
|
||||||
|
{
|
||||||
|
if ($password1 !== $password2) {
|
||||||
|
$error = 'Ïàðîëè íå ñîâïàäàþò';
|
||||||
|
}
|
||||||
|
if (strlen($password1 < 8)) {
|
||||||
|
$error = 'Ïàðîëü äîëæåí áûòü áîëüøå 8 ñèìâîëîâ';
|
||||||
|
$error .= 'Ìîæåòå èñïîëüçîâàòü ñãåíåðèðîâàííûé ïàðîëü: ' . PassGen::new();
|
||||||
|
}
|
||||||
|
return $error ?? '';
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function new(string $login, string $password, string $email, $ref, $birthday, $sex): string
|
||||||
|
{
|
||||||
|
Db::sql(
|
||||||
|
'insert into users (users.real,login,host_reg,pass,ip,ipreg,room,timereg,activ,mail,bithday,sex,fnq,design,molch2,level,hobby,clan_zv) values (1,?,?,?,?,?,9,unix_timestamp(),0,?,?,?,0,1,unix_timestamp() + 86400,8,\'\',0)',
|
||||||
|
[
|
||||||
|
$login,
|
||||||
|
(int)$ref,
|
||||||
|
md5($password),
|
||||||
|
UserIp::get(),
|
||||||
|
UserIp::get(),
|
||||||
|
$email,
|
||||||
|
date('d.m.Y', strtotime($birthday)),
|
||||||
|
$sex - 10,
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
return Db::lastInsertId();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,25 +1,25 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
use Insallah\Db;
|
use Core\Db;
|
||||||
|
|
||||||
class UserStats
|
class UserStats
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Ñîáèðàåò ñóììû âñåõ áîíóñîâ ñ îäåòûõ ïðåäìåòîâ è àêòèâíûõ ýôåêòîâ.
|
* Ñîáèðàåò ñóììû âñåõ áîíóñîâ ñ îäåòûõ ïðåäìåòîâ è àêòèâíûõ ýôåêòîâ.
|
||||||
* @param $userId
|
* @param int $userId
|
||||||
|
* @param bool $showAll
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public static function getAllBonuses($userId, $showAll = false)
|
public static function getAllBonuses(int $userId, bool $showAll = false): array
|
||||||
{
|
{
|
||||||
require_once '_incl_data/class/Insallah/Core/Db.php';
|
|
||||||
$db = new Db();
|
|
||||||
$q = 'select data from items_users where uid = ? and inOdet > 0 and `delete` = 0
|
$q = 'select data from items_users where uid = ? and inOdet > 0 and `delete` = 0
|
||||||
union all select data from eff_users where uid = ? and `delete` = 0';
|
union all select data from eff_users where uid = ? and `delete` = 0';
|
||||||
$iData = $db::getColumn($q, [$userId, $userId]);
|
$iData = Db::getColumn($q, [$userId, $userId]);
|
||||||
$params = [];
|
$params = [];
|
||||||
foreach ($iData as $datum) {
|
foreach ($iData as $datum) {
|
||||||
foreach (explode('|', $datum) as $inner) {
|
foreach (explode('|', $datum) as $inner) {
|
||||||
list($a, $b) = explode('=', $inner);
|
[$a, $b] = explode('=', $inner);
|
||||||
if (strpos($a, 'add') !== false || strpos($a, 'sv') !== false || $showAll) {
|
if (strpos($a, 'add') !== false || strpos($a, 'sv') !== false || $showAll) {
|
||||||
if (isset($params[$a])) {
|
if (isset($params[$a])) {
|
||||||
$params[$a] += $b;
|
$params[$a] += $b;
|
||||||
|
@ -11,10 +11,8 @@ $db = [
|
|||||||
];
|
];
|
||||||
$dsn = 'mysql:host=' . $db['s'] . ';dbname=' . $db['d'];
|
$dsn = 'mysql:host=' . $db['s'] . ';dbname=' . $db['d'];
|
||||||
|
|
||||||
include './_incl_data/mysql_override.php';
|
include_once dirname(__DIR__) . DIRECTORY_SEPARATOR . 'mysql_override.php';
|
||||||
|
|
||||||
$dbgo = mysql_connect($db['s'], $db['u'], $db['p']);
|
$dbgo = mysql_connect($db['s'], $db['u'], $db['p']);
|
||||||
mysql_select_db($db['d'], $dbgo);
|
mysql_select_db($db['d'], $dbgo);
|
||||||
mysql_query('SET NAMES cp1251');
|
mysql_query('SET NAMES cp1251');
|
||||||
|
|
||||||
$pdo = new PDO($dsn, $db['u'], $db['p'], [PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES cp1251"]);
|
|
||||||
|
@ -60,7 +60,11 @@ if( isset($pr_used_this) && isset($pr_moment) ) {
|
|||||||
mysql_query('UPDATE `eff_users` SET `data` = "'.$pvr['redata'].'" WHERE `id` = "'.$btl->stats[$btl->uids[$u1]]['effects'][$prv['j_priem']]['id'].'" LIMIT 1');
|
mysql_query('UPDATE `eff_users` SET `data` = "'.$pvr['redata'].'" WHERE `id` = "'.$btl->stats[$btl->uids[$u1]]['effects'][$prv['j_priem']]['id'].'" LIMIT 1');
|
||||||
//
|
//
|
||||||
$pvr['hp'] = floor($pvr['hp']);
|
$pvr['hp'] = floor($pvr['hp']);
|
||||||
|
/*$pvr['hp'] = $priem->magatack( $u2, $u1, $pvr['hp'], 'âîäŕ', 0 );
|
||||||
|
$pvr['promah_type'] = $pvr['hp'][3];
|
||||||
|
$pvr['promah'] = $pvr['hp'][2];
|
||||||
|
$pvr['krit'] = $pvr['hp'][1];
|
||||||
|
$pvr['hp'] = $pvr['hp'][0];*/
|
||||||
$pvr['hpSee'] = '--';
|
$pvr['hpSee'] = '--';
|
||||||
$pvr['hpNow'] = floor($btl->stats[$btl->uids[$u1]]['hpNow']);
|
$pvr['hpNow'] = floor($btl->stats[$btl->uids[$u1]]['hpNow']);
|
||||||
$pvr['hpAll'] = $btl->stats[$btl->uids[$u1]]['hpAll'];
|
$pvr['hpAll'] = $btl->stats[$btl->uids[$u1]]['hpAll'];
|
||||||
|
@ -109,4 +109,3 @@ if (
|
|||||||
}
|
}
|
||||||
unset($pvr);
|
unset($pvr);
|
||||||
?>
|
?>
|
||||||
?>
|
|
@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Ïðèåì: Öåëü {ñòèõèÿ}
|
* Ïðèåì: Öåëü {ñòèõèÿ}
|
||||||
* @var $this Priems
|
* @var $this priems
|
||||||
* @var $btl Battle
|
* @var $btl battleClass
|
||||||
* @var $id
|
* @var $id
|
||||||
* @var $pl
|
* @var $pl
|
||||||
*/
|
*/
|
||||||
|
@ -41,12 +41,32 @@ if( isset($pr_used_this) && isset($pr_moment) ) {
|
|||||||
$pvr['promah'] = $pvr['hp'][2];
|
$pvr['promah'] = $pvr['hp'][2];
|
||||||
$pvr['krit'] = $pvr['hp'][1];
|
$pvr['krit'] = $pvr['hp'][1];
|
||||||
$pvr['hp'] = $pvr['hp'][0];
|
$pvr['hp'] = $pvr['hp'][0];
|
||||||
|
/*//
|
||||||
|
$pvr['data'] = $priem->lookStatsArray($btl->stats[$btl->uids[$u1]]['effects'][$prv['j_priem']]['data']);
|
||||||
|
$pvr['di'] = 0;
|
||||||
|
$pvr['dc'] = count($pvr['data']['atgm']);
|
||||||
|
$pvr['rd'] = 0;
|
||||||
|
$pvr['redata'] = '';
|
||||||
|
while( $pvr['di'] < 4 ) {
|
||||||
|
if( isset($pvr['data']['atgm'][($pvr['dc']-$pvr['di'])]) ) {
|
||||||
|
if( $pvr['rd'] < 3 ) {
|
||||||
|
$pvr['hp'] += $pvr['data']['atgm'][($pvr['dc']-$pvr['di'])];
|
||||||
|
$pvr['redata'] = 'atgm='.$pvr['data']['atgm'][($pvr['dc']-$pvr['di'])].'|'.$pvr['redata'];
|
||||||
|
$pvr['rd']++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$pvr['di']++;
|
||||||
|
}*/
|
||||||
|
//
|
||||||
$btl->stats[$btl->uids[$u1]]['effects'][$prv['j_priem']]['data'] = $pvr['redata'];
|
$btl->stats[$btl->uids[$u1]]['effects'][$prv['j_priem']]['data'] = $pvr['redata'];
|
||||||
mysql_query('UPDATE `eff_users` SET `data` = "'.$pvr['redata'].'" WHERE `id` = "'.$btl->stats[$btl->uids[$u1]]['effects'][$prv['j_priem']]['id'].'" LIMIT 1');
|
mysql_query('UPDATE `eff_users` SET `data` = "'.$pvr['redata'].'" WHERE `id` = "'.$btl->stats[$btl->uids[$u1]]['effects'][$prv['j_priem']]['id'].'" LIMIT 1');
|
||||||
//
|
//
|
||||||
$pvr['hp'] = floor($pvr['hp']);
|
$pvr['hp'] = floor($pvr['hp']);
|
||||||
|
/*$pvr['hp'] = $priem->magatack( $u2, $u1, $pvr['hp'], 'âîäà', 0 );
|
||||||
|
$pvr['promah_type'] = $pvr['hp'][3];
|
||||||
|
$pvr['promah'] = $pvr['hp'][2];
|
||||||
|
$pvr['krit'] = $pvr['hp'][1];
|
||||||
|
$pvr['hp'] = $pvr['hp'][0];*/
|
||||||
$pvr['hpSee'] = '--';
|
$pvr['hpSee'] = '--';
|
||||||
$pvr['hpNow'] = floor($btl->stats[$btl->uids[$u1]]['hpNow']);
|
$pvr['hpNow'] = floor($btl->stats[$btl->uids[$u1]]['hpNow']);
|
||||||
$pvr['hpAll'] = $btl->stats[$btl->uids[$u1]]['hpAll'];
|
$pvr['hpAll'] = $btl->stats[$btl->uids[$u1]]['hpAll'];
|
||||||
|
@ -57,7 +57,11 @@ if( isset($pr_used_this) && isset($pr_moment) ) {
|
|||||||
mysql_query('UPDATE `eff_users` SET `data` = "'.$pvr['redata'].'" WHERE `id` = "'.$btl->stats[$btl->uids[$u1]]['effects'][$prv['j_priem']]['id'].'" LIMIT 1');
|
mysql_query('UPDATE `eff_users` SET `data` = "'.$pvr['redata'].'" WHERE `id` = "'.$btl->stats[$btl->uids[$u1]]['effects'][$prv['j_priem']]['id'].'" LIMIT 1');
|
||||||
//
|
//
|
||||||
$pvr['hp'] = floor($pvr['hp']);
|
$pvr['hp'] = floor($pvr['hp']);
|
||||||
|
/*$pvr['hp'] = $priem->magatack( $u2, $u1, $pvr['hp'], 'âîäŕ', 0 );
|
||||||
|
$pvr['promah_type'] = $pvr['hp'][3];
|
||||||
|
$pvr['promah'] = $pvr['hp'][2];
|
||||||
|
$pvr['krit'] = $pvr['hp'][1];
|
||||||
|
$pvr['hp'] = $pvr['hp'][0];*/
|
||||||
$pvr['hpSee'] = '--';
|
$pvr['hpSee'] = '--';
|
||||||
$pvr['hpNow'] = floor($btl->stats[$btl->uids[$u1]]['hpNow']);
|
$pvr['hpNow'] = floor($btl->stats[$btl->uids[$u1]]['hpNow']);
|
||||||
$pvr['hpAll'] = $btl->stats[$btl->uids[$u1]]['hpAll'];
|
$pvr['hpAll'] = $btl->stats[$btl->uids[$u1]]['hpAll'];
|
||||||
|
@ -59,7 +59,11 @@ if( isset($pr_used_this) && isset($pr_moment) ) {
|
|||||||
mysql_query('UPDATE `eff_users` SET `data` = "'.$pvr['redata'].'" WHERE `id` = "'.$btl->stats[$btl->uids[$u1]]['effects'][$prv['j_priem']]['id'].'" LIMIT 1');
|
mysql_query('UPDATE `eff_users` SET `data` = "'.$pvr['redata'].'" WHERE `id` = "'.$btl->stats[$btl->uids[$u1]]['effects'][$prv['j_priem']]['id'].'" LIMIT 1');
|
||||||
//
|
//
|
||||||
$pvr['hp'] = floor($pvr['hp']);
|
$pvr['hp'] = floor($pvr['hp']);
|
||||||
|
/*$pvr['hp'] = $priem->magatack( $u2, $u1, $pvr['hp'], 'âîäŕ', 0 );
|
||||||
|
$pvr['promah_type'] = $pvr['hp'][3];
|
||||||
|
$pvr['promah'] = $pvr['hp'][2];
|
||||||
|
$pvr['krit'] = $pvr['hp'][1];
|
||||||
|
$pvr['hp'] = $pvr['hp'][0];*/
|
||||||
$pvr['hpSee'] = '--';
|
$pvr['hpSee'] = '--';
|
||||||
$pvr['hpNow'] = floor($btl->stats[$btl->uids[$u1]]['hpNow']);
|
$pvr['hpNow'] = floor($btl->stats[$btl->uids[$u1]]['hpNow']);
|
||||||
$pvr['hpAll'] = $btl->stats[$btl->uids[$u1]]['hpAll'];
|
$pvr['hpAll'] = $btl->stats[$btl->uids[$u1]]['hpAll'];
|
||||||
|
@ -56,6 +56,7 @@ if( isset($pr_used_this) && isset($pr_moment) && !isset($btl->info['id']) && !is
|
|||||||
mysql_query('UPDATE `eff_users` SET `data` = "'.$pvr['redata'].'" WHERE `id` = "'.$btl->stats[$btl->uids[$u1]]['effects'][$prv['j_priem']]['id'].'" LIMIT 1');
|
mysql_query('UPDATE `eff_users` SET `data` = "'.$pvr['redata'].'" WHERE `id` = "'.$btl->stats[$btl->uids[$u1]]['effects'][$prv['j_priem']]['id'].'" LIMIT 1');
|
||||||
//
|
//
|
||||||
$pvr['hp'] = floor($pvr['hp']);
|
$pvr['hp'] = floor($pvr['hp']);
|
||||||
|
//$pvr['hp'] = $priem->magatack( $u2, $u1, $pvr['hp'], 'âîäà', 0 );
|
||||||
$pvr['promah_type'] = 0;
|
$pvr['promah_type'] = 0;
|
||||||
$pvr['promah'] = false;
|
$pvr['promah'] = false;
|
||||||
$pvr['krit'] = false;
|
$pvr['krit'] = false;
|
||||||
|
101
_incl_data/crons/bank_updateExchangeRates.php
Normal file
101
_incl_data/crons/bank_updateExchangeRates.php
Normal file
@ -0,0 +1,101 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Core\Config;
|
||||||
|
use Core\Db;
|
||||||
|
|
||||||
|
require_once dirname(__DIR__) . DIRECTORY_SEPARATOR . 'autoload.php';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Îáíîâëåíèå äàííûõ î êóðñàõ âàëþò èç Öåíòðîáàíêà ÐÔ.
|
||||||
|
* Ðàç â äåíü â ÷àñ íî÷è.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Îáíóëåíèå(?!) ïåðåäà÷ ðàç â ñóòêè
|
||||||
|
Db::sql('update stats set transfers = 100 where transfers < 200');
|
||||||
|
|
||||||
|
function getCurs()
|
||||||
|
{
|
||||||
|
// ñîçäàåì îáúåêò äëÿ ðàáîòû ñ XML
|
||||||
|
$xml = new DOMDocument();
|
||||||
|
// ññûëêà íà ñàéò áàíêà
|
||||||
|
$url = 'https://www.cbr.ru/scripts/XML_daily.asp?date_req=' . date('d.m.Y');
|
||||||
|
// ïîëó÷àåì xml ñ êóðñàìè âñåõ âàëþò
|
||||||
|
if (!$xml->load($url)) {
|
||||||
|
// åñëè íå ïîëó÷èëè xml âîçâðàùàåì false
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
// ìàññèâ äëÿ õðàíåíèÿ êóðñîâ âàëþò
|
||||||
|
$result = [];
|
||||||
|
// ðàçáèðàåì xml
|
||||||
|
$root = $xml->documentElement;
|
||||||
|
// áåðåì âñå òåãè 'Valute' è èõ ñîäåðæèìîå
|
||||||
|
$items = $root->getElementsByTagName('Valute');
|
||||||
|
// ïåðåáåðåì òåãè 'Valute' ïî îäíîìó
|
||||||
|
foreach ($items as $item) {
|
||||||
|
// ïîëó÷àåì êîä âàëþòû
|
||||||
|
$code = $item->getElementsByTagName('CharCode')->item(0)->nodeValue;
|
||||||
|
// ïîëó÷àåì çíà÷åíèå êóðñà âàëþòû, îòíîñèòåëüíî ðóáëÿ
|
||||||
|
$value = $item->getElementsByTagName('Value')->item(0)->nodeValue;
|
||||||
|
// íîìèíàë
|
||||||
|
$nominal = $item->getElementsByTagName('Nominal')->item(0)->nodeValue;
|
||||||
|
// çàïèñûâàåì â ìàññèâ, ïðåäâàðèòåëüíî çàìåíèâ çàïÿòóþ íà òî÷êó
|
||||||
|
$result[$code] = round(str_replace(',', '.', $value), 5) / $nominal;
|
||||||
|
}// âîçâðàùàåì çíà÷åíèå êóðñà, äëÿ çàïðîøåííîé âàëþòû
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
|
$get = getCurs();
|
||||||
|
if (Config::get('curency_name') === 'RUB') {
|
||||||
|
$curency = Config::get('curency_value');
|
||||||
|
} else {
|
||||||
|
$curency = round($get[Config::get('curency_name')] * Config::get('curency_value'), 4);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($get['USD'] > 0) {
|
||||||
|
$price = [
|
||||||
|
'AUD',
|
||||||
|
'AZN',
|
||||||
|
'AMD',
|
||||||
|
'BYR',
|
||||||
|
'BGN',
|
||||||
|
'BRL',
|
||||||
|
'HUF',
|
||||||
|
'KRW',
|
||||||
|
'DKK',
|
||||||
|
'USD',
|
||||||
|
'EUR',
|
||||||
|
'INR',
|
||||||
|
'KZT',
|
||||||
|
'CAD',
|
||||||
|
'KGS',
|
||||||
|
'CNY',
|
||||||
|
'LVL',
|
||||||
|
'LTL',
|
||||||
|
'MDL',
|
||||||
|
'RON',
|
||||||
|
'TMT',
|
||||||
|
'NOK',
|
||||||
|
'PLN',
|
||||||
|
'XDR',
|
||||||
|
'SGD',
|
||||||
|
'TJS',
|
||||||
|
'TRY',
|
||||||
|
'UZS',
|
||||||
|
'UAH',
|
||||||
|
'GBP',
|
||||||
|
'CZK',
|
||||||
|
'SEK',
|
||||||
|
'CHF',
|
||||||
|
'ZAR',
|
||||||
|
'JPY',
|
||||||
|
];
|
||||||
|
$r = '';
|
||||||
|
foreach ($price as $value) {
|
||||||
|
if (!$get[$value]) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
$r .= ',`' . $value . '`="' . $get[$value] . '"';
|
||||||
|
}
|
||||||
|
|
||||||
|
Db::sql('insert into bank_table set time = unix_timestamp(), cur = ?, data = ?', [$curency, date('d.m.Y') . $r]);
|
||||||
|
}
|
19
_incl_data/crons/battle_clear.php
Normal file
19
_incl_data/crons/battle_clear.php
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Core\Db;
|
||||||
|
|
||||||
|
require_once dirname(__DIR__) . DIRECTORY_SEPARATOR . 'autoload.php';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ×èñòêà è ñáðîñ ñ÷åò÷èêîâ ïðè îòñóòñòâèè áîåâ ÷òîá íå ëàìàëñÿ ëîã.
|
||||||
|
* Çàïóñê êàæäûå òðè ÷àñà â Õ ÷àñîâ 20 ìèíóò?
|
||||||
|
*/
|
||||||
|
|
||||||
|
Db::sql('delete from battle_end where time < unix_timestamp() - 24 * 60 * 60');
|
||||||
|
Db::sql('delete from battle_last where time < unix_timestamp() - 24 * 60 * 60');
|
||||||
|
Db::sql('delete from battle_out where time < unix_timestamp() - 24 * 60 * 60');
|
||||||
|
Db::sql('delete from battle_stat where time < unix_timestamp() - 24 * 60 * 60');
|
||||||
|
Db::sql('delete from battle_logs where time < unix_timestamp() - 24 * 60 * 60');
|
||||||
|
Db::sql('delete from battle_logs_save where time < unix_timestamp() - 24 * 60 * 60');
|
||||||
|
Db::sql('delete from battle_users where time_enter between 1 and unix_timestamp() - 24 * 60 * 60');
|
||||||
|
Db::sql('delete from battle where time_over between 1 and unix_timestamp() - 24 * 60 * 60');
|
101
_incl_data/crons/battle_finish.php
Normal file
101
_incl_data/crons/battle_finish.php
Normal file
@ -0,0 +1,101 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Core\Db;
|
||||||
|
|
||||||
|
require_once dirname(__DIR__) . DIRECTORY_SEPARATOR . 'autoload.php';
|
||||||
|
|
||||||
|
/* CRON Çàâåðøåíèå ïîåäèíêà è óäàëåíèå èç çàÿâîê */
|
||||||
|
|
||||||
|
# Çàïóñê ðàç â ìèíóòó.
|
||||||
|
|
||||||
|
function getIds($query): string
|
||||||
|
{
|
||||||
|
return implode(',', Db::getColumn($query));
|
||||||
|
}
|
||||||
|
|
||||||
|
# HOUR = 1800
|
||||||
|
Db::sql(
|
||||||
|
'update users
|
||||||
|
left join battle on users.battle = battle.id
|
||||||
|
left join battle_logs on battle_logs.id = battle.id
|
||||||
|
set
|
||||||
|
users.battle = 0,
|
||||||
|
battle.team_win = 0,
|
||||||
|
battle.time_over = unix_timestamp()
|
||||||
|
where
|
||||||
|
battle.team_win = -1 and
|
||||||
|
battle.time_start < unix_timestamp() - 1800 * 2 and
|
||||||
|
battle_logs.time < unix_timestamp() - 1800 *2'
|
||||||
|
);
|
||||||
|
|
||||||
|
$bid = Db::getColumn('select id from battle where time_start < unix_timestamp() - 180 and team_win = -1 and typeBattle = 9');
|
||||||
|
foreach ($bid as $item) {
|
||||||
|
$count = Db::getValue('select count(*) from users where battle = ?', [$item]);
|
||||||
|
if ($count < 8) {
|
||||||
|
$timeout = 60;
|
||||||
|
} elseif ($count < 12) {
|
||||||
|
$timeout = 120;
|
||||||
|
} else {
|
||||||
|
$timeout = 180;
|
||||||
|
}
|
||||||
|
Db::sql('update battle set timeout = ? where id = ?', [$timeout, $item]);
|
||||||
|
}
|
||||||
|
unset($bid);
|
||||||
|
Db::sql('delete from battle_cache where time < unix_timestamp() - 3600');
|
||||||
|
|
||||||
|
|
||||||
|
//$bid = getIds('select id from battle where type = 33 and (time_over < unix_timestamp() - 120 or time_over > unix_timestamp() - 360)');
|
||||||
|
|
||||||
|
////äè÷ü, íåâûïîëíèìîå óñëîâèå: `time_over` < "'.(time()-120).'" AND `time_over` > "'.(time() - 360).'" AND `time_over` != 0
|
||||||
|
//// óòî÷íèòü ðåàëèçàöèþ
|
||||||
|
|
||||||
|
//âûòàñêèâàåì ïåðñîâ èç ïðèç õàîòà åñëè çàñòðßëè (1-5 ìèíóò îêîí÷àíèå)
|
||||||
|
//$sp = mysql_fetch_array(mysql_query('SELECT * FROM `battle` WHERE `type` = 33 AND `time_over` < "'.(time()-120).'" AND `time_over` > "'.(time() - 360).'" AND `time_over` != 0 ORDER BY `battle`.`time_over` DESC LIMIT 1'));
|
||||||
|
//if (isset($sp['id']))
|
||||||
|
// {
|
||||||
|
// mysql_query('UPDATE `battle` SET `time_over` = `time_over` - 300 WHERE `id` = "'.$sp['id'].'" LIMIT 1');
|
||||||
|
// $sps = mysql_query('SELECT * FROM `users` WHERE `mail` LIKE "haot@new-combats.com" AND `battle` = 0');
|
||||||
|
// while( $pl = mysql_fetch_array($sps))
|
||||||
|
// {
|
||||||
|
// if (isset($pl['id']))
|
||||||
|
// {
|
||||||
|
// mysql_query('UPDATE `users` SET `inUser` = "0" WHERE `inUser` = "'.$pl['id'].'" LIMIT 1');
|
||||||
|
// mysql_query('DELETE FROM `users` WHERE `id` = "'.$pl['id'].'" LIMIT 1');
|
||||||
|
// mysql_query('DELETE FROM `stats` WHERE `id` = "'.$pl['id'].'" LIMIT 1');
|
||||||
|
// mysql_query('DELETE FROM `items_users` WHERE `uid` = "'.$pl['id'].'" LIMIT 100');
|
||||||
|
// mysql_query('DELETE FROM `eff_users` WHERE `uid` = "'.$pl['id'].'" LIMIT 100');
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
//‚ûòàñêèâàåì ïåðñîâ åñëè çàñòðßëè â áîßõ
|
||||||
|
|
||||||
|
//todo, âñ¸, íè÷åãî íå ñîîáðàæàþ. äîäåëàòü çàïðîñ, ÷òîáû îí ó÷èòûâàë: || !isset($test['id']
|
||||||
|
|
||||||
|
//'update users
|
||||||
|
// left join stats on users.id = stats.id
|
||||||
|
// left join battle on users.id = battle.id
|
||||||
|
//set
|
||||||
|
// users.battle = 0,
|
||||||
|
// stats.battle_yron = 0
|
||||||
|
//where
|
||||||
|
// users.battle > 0 and
|
||||||
|
// battle.time_over between 1 and unix_timestamp() - 600';
|
||||||
|
|
||||||
|
$sps = mysql_query('SELECT * FROM `users` WHERE `battle` > 0');
|
||||||
|
while( $pl = mysql_fetch_array($sps))
|
||||||
|
{
|
||||||
|
if (isset($pl['id']))
|
||||||
|
{
|
||||||
|
$test = mysql_fetch_array(mysql_query('SELECT * FROM `battle` WHERE `id` = "'.$pl['battle'].'" LIMIT 1'));
|
||||||
|
if (($test['time_over'] < (time()-600) && $test['time_over'] !=0) || !isset($test['id']))
|
||||||
|
{
|
||||||
|
mysql_query('UPDATE `users` SET `battle`= 0 WHERE `id` = "'.$pl['id'].'" LIMIT 1');
|
||||||
|
mysql_query('UPDATE `stats` SET `battle_yron` = 0 WHERE `id` = "'.$pl['id'].'" LIMIT 1');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//÷èñòèì ïàìßòü
|
||||||
|
unset($sp,$sps,$pl,$test);
|
||||||
|
|
16
_incl_data/crons/battle_start.php
Normal file
16
_incl_data/crons/battle_start.php
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Insallah\Tournaments\Tournament;
|
||||||
|
|
||||||
|
require_once dirname(__DIR__) . DIRECTORY_SEPARATOR . 'autoload.php';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Проверяем и стартуем турниры (старые), групповые и хаотические поединки.
|
||||||
|
* Дописал сюда и новые турниры тоже.
|
||||||
|
*
|
||||||
|
* Запускается каждые 10 милисекунд!!!
|
||||||
|
* 5 раз в секунду с таймером в 10 милисекунд.
|
||||||
|
*/
|
||||||
|
|
||||||
|
(new FightRequest())->testCronZv();
|
||||||
|
Tournament::startAllBattles();
|
49
_incl_data/crons/battle_startPrizhaot.php
Normal file
49
_incl_data/crons/battle_startPrizhaot.php
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Core\Db;
|
||||||
|
|
||||||
|
require_once dirname(__DIR__) . DIRECTORY_SEPARATOR . 'autoload.php';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Çàïóñê ïðèçîâîãî õàîòà.
|
||||||
|
* Çàïóñê êàæäûé ÷àñ â Õ ÷àñîâ 10 ìèíóò ñ 8 óòðà äî 2 íî÷è.
|
||||||
|
* Î_Î
|
||||||
|
*/
|
||||||
|
|
||||||
|
//Ïîäàåì òóðíèð (õàîò) äëÿ 8-11 óðîâíåé
|
||||||
|
|
||||||
|
Db::sql(
|
||||||
|
'insert into zayvki (
|
||||||
|
comment,
|
||||||
|
arand,
|
||||||
|
noatack,
|
||||||
|
city,
|
||||||
|
creator,
|
||||||
|
type,
|
||||||
|
time_start,
|
||||||
|
timeout,
|
||||||
|
min_lvl_1,
|
||||||
|
min_lvl_2,
|
||||||
|
max_lvl_1,
|
||||||
|
max_lvl_2,
|
||||||
|
noinc,
|
||||||
|
razdel,
|
||||||
|
time,
|
||||||
|
fastfight,
|
||||||
|
priz,
|
||||||
|
maxplayers,
|
||||||
|
tm1max,
|
||||||
|
tm2max
|
||||||
|
)
|
||||||
|
values (?,1,1,\'capitalcity\',0,33,300,180,8,8,12,12,1,5,unix_timestamp(),1,1,40,0,0)',
|
||||||
|
[
|
||||||
|
"<i style='color: green;'>Àâòîçàÿâêà! <b>Òåñò ïðîøó íå çàõîäèòü</b></i>", 'capitalcity',
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
Db::sql(
|
||||||
|
'insert into chat (`text`,`type`,`new`,`time`) values (?,6,1,unix_timestamp())',
|
||||||
|
[
|
||||||
|
"<span style='color: red'>Âíèìàíèå!!!</span> <span style='color:#cb0000'><b>Ãåðîè÷åñêîå Ñðàæåíèå</b> íà÷àëîñü.</span>",
|
||||||
|
]
|
||||||
|
);
|
109
_incl_data/crons/bot_calls.php
Normal file
109
_incl_data/crons/bot_calls.php
Normal file
@ -0,0 +1,109 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Âûçîâ áîòîâ â èãðîâûå êîìíàòû.
|
||||||
|
*
|
||||||
|
* Çàïóñê ðàç â ìèíóòó.
|
||||||
|
*/
|
||||||
|
|
||||||
|
use Core\Db;
|
||||||
|
|
||||||
|
require_once dirname(__DIR__) . DIRECTORY_SEPARATOR . 'autoload.php';
|
||||||
|
|
||||||
|
|
||||||
|
function makeLogin(int $id, string $login, int $level): string
|
||||||
|
{
|
||||||
|
return <<<HTML
|
||||||
|
<strong>$login</strong> [$level]
|
||||||
|
<a target='_blank' href='inf.php?$id'>
|
||||||
|
<img src=https://img.new-combats.com/i/inf_capitalcity.gif alt='inf'>
|
||||||
|
</a>
|
||||||
|
HTML;
|
||||||
|
}
|
||||||
|
|
||||||
|
function testMonster(array $mon): bool // ×ÒÎ ÒÛ ÁËßÒÜ ÒÀÊÎÅ? ×ÒÎ ÒÛ ÏÐÎÂÅÐßÅØÜ? ÊÀÊ ÒÛ ÐÀÁÎÒÀÅØÜ?
|
||||||
|
{
|
||||||
|
return
|
||||||
|
(
|
||||||
|
$mon['back_day'] === -1 ||
|
||||||
|
(
|
||||||
|
$mon['back_day'] === 7 ||
|
||||||
|
$mon['back_day'] === idate('w')
|
||||||
|
) &&
|
||||||
|
$mon['back_day'] === 7
|
||||||
|
) &&
|
||||||
|
(
|
||||||
|
$mon['back_dd'] === -1 ||
|
||||||
|
$mon['back_dd'] === idate('j')
|
||||||
|
) &&
|
||||||
|
(
|
||||||
|
$mon['back_mm'] === -1 ||
|
||||||
|
$mon['back_mm'] === idate('n')
|
||||||
|
) &&
|
||||||
|
(
|
||||||
|
$mon['back_hh'] === -1 ||
|
||||||
|
$mon['back_hh'] === idate('H') &&
|
||||||
|
(
|
||||||
|
$mon['back_min'] === -1 ||
|
||||||
|
$mon['back_min'] >= idate('i')
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
$rows = Db::getRows('select * from users left join stats on users.id = stats.id where no_ip = \'trupojor\' limit 100');
|
||||||
|
|
||||||
|
foreach ($rows as $row) {
|
||||||
|
$act = 0;
|
||||||
|
if ($row['online'] < time() - 60) {
|
||||||
|
$row['online'] = time();
|
||||||
|
Db::sql('update users set online = ? where id = ?', [$row['online'], $row['id']]);
|
||||||
|
}
|
||||||
|
|
||||||
|
$mon = Db::getRow('select * from aaa_monsters where uid = ?', [$row['id']]);
|
||||||
|
|
||||||
|
if ($row['res_x'] < time()) {
|
||||||
|
if (isset($mon['id'])) { //åñëè áîò â ñïåöèàëüíîì ñïèñêå
|
||||||
|
// åñëè áîò ñïðÿòàí â äîìèêå (303) - âûïóñêàåì è ëå÷èì åãî
|
||||||
|
if (testMonster($mon) && $row['room'] == 303) {
|
||||||
|
Db::sql('update users set room = ? where id = ?', [$mon['start_room'], $row['id']]);
|
||||||
|
Db::sql('update stats set hpNow = hpAll, mpNow = mpAll where id = ?', [$row['id']]);
|
||||||
|
if ($mon['start_text']) {
|
||||||
|
$str = '<span style="color: red">Âíèìàíèå!</span> ';
|
||||||
|
$str .= str_replace('{b}', makeLogin($row['id'], $row['login'], $row['level']), $mon['start_text']);
|
||||||
|
Db::sql(
|
||||||
|
'insert into chat (text, city, type, new, time) values (?,?,6,1,unix_timestamp())',
|
||||||
|
[$str, $row['city']]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
$act = 1;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
//+1hour
|
||||||
|
Db::sql('update stats set res_x = unix_timestamp() + 3600 where id = ?', [$row['id']]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (
|
||||||
|
$act == 0 &&
|
||||||
|
$row['room'] != 303 &&
|
||||||
|
$row['battle'] == 0 &&
|
||||||
|
isset($mon['id']) &&
|
||||||
|
testMonster($mon)
|
||||||
|
) {
|
||||||
|
// åñëè áîò íå â äîìèêå, îòïðàëÿåì â äîìèê (303).
|
||||||
|
Db::sql('update users set room = 303 where id = ?', [$row['id']]);
|
||||||
|
if ($mon['back_text']) {
|
||||||
|
$str = '<span style="color: red">Âíèìàíèå!</span> ';
|
||||||
|
$str .= str_replace('{b}', makeLogin($row['id'], $row['login'], $row['level']), $mon['back_text']);
|
||||||
|
Db::sql(
|
||||||
|
'insert into chat (text, city, type, new, time)
|
||||||
|
values
|
||||||
|
(?,?,6,1,unix_timestamp()),
|
||||||
|
(?,?,1,1,unix_timestamp())',
|
||||||
|
[$str, $row['city'], $str, $row['city']]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
$act = 2;
|
||||||
|
}
|
||||||
|
sleep(1);
|
||||||
|
}
|
60
_incl_data/crons/bot_core.php
Normal file
60
_incl_data/crons/bot_core.php
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Core\Db;
|
||||||
|
|
||||||
|
require_once dirname(__DIR__) . DIRECTORY_SEPARATOR . 'autoload.php';
|
||||||
|
|
||||||
|
# Êàêèå-òî îïåðàöèè íàä áîòàìè.
|
||||||
|
## Ýòîò ôàéë óïðàâëÿåò âñåé ëîãèêîé âñåõ áîòîâ âåçäå.
|
||||||
|
## BotLogic::start - î÷åíü òÿæåëûé íà çàïðîñû êëàññ.
|
||||||
|
|
||||||
|
# ðàç â ìèíóòó
|
||||||
|
# Ðàíüøå â êðîíå áûë äîïîëíèòåëüíûé òàéìåð íà îáíîâëåíèå êàæäûå 4 ñåêóíäû.
|
||||||
|
# Åñëè áîòàì áóäåò ìàëî ìèíóòû, èãðàòüñÿ òàéìåðîì.
|
||||||
|
|
||||||
|
$uids = implode(
|
||||||
|
',',
|
||||||
|
Db::getColumn('select id from users where no_ip = ? or pass = ?', ['trupojor', 'saintlucia'])
|
||||||
|
);
|
||||||
|
|
||||||
|
Db::sql("update stats left join users on stats.id = users.id set exp = 400000 where exp > 400000 and level = 8 and stats.id in ($uids)");
|
||||||
|
Db::sql("update stats left join users on stats.id = users.id set exp = 3500000 where exp > 3500000 and level = 9 and stats.id in ($uids)");
|
||||||
|
Db::sql("update stats left join users on stats.id = users.id set exp = 48000000 where exp > 48000000 and level = 10 and stats.id in ($uids)");
|
||||||
|
Db::sql("update stats left join users on stats.id = users.id set exp = 148000000 where exp > 148000000 and level = 11 and stats.id in ($uids)");
|
||||||
|
Db::sql("update stats left join users on stats.id = users.id set exp = 400000000 where exp > 400000000 and level = 12 and stats.id in ($uids)");
|
||||||
|
|
||||||
|
Db::sql("update users set online = unix_timestamp() where timereg != 0 and id in ($uids)");
|
||||||
|
Db::sql("update users set timereg = unix_timestamp() where timereg = 0 and id in ($uids)");
|
||||||
|
|
||||||
|
Db::sql("update stats set bot = 2 where bot = 0 and id in ($uids)");
|
||||||
|
|
||||||
|
Db::sql("update stats set nextAct = unix_timestamp() where id in ($uids)");
|
||||||
|
|
||||||
|
# ×ÒÎ ÒÛ ÒÀÊÎÅ ÁËßÒÜ?!
|
||||||
|
$btltest = [];
|
||||||
|
$data = Db::getRows('select zv, stats.id, battle from users left join stats on users.id = stats.id where no_ip = ? or pass = ? order by nextAct', ['trupojor', 'saintlucia']);
|
||||||
|
foreach ($data as $row) {
|
||||||
|
if ($row['zv']) {
|
||||||
|
$zv = Db::getValue('select razdel from zayvki where id = ? and btl_id = 0 and razdel != 5', [$row['zv']]);
|
||||||
|
if ($zv) {
|
||||||
|
Db::sql('update stats set zv = 0 where id = ?', [$row['id']]);
|
||||||
|
$row['zv'] = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($row['battle']=== -1) {
|
||||||
|
Db::sql('update users left join stats on users.id = stats.id set battle = 0, ipreg = 0, zv = 0 where users.id = ?', [$row['id']]);
|
||||||
|
$row['battle'] = 0;
|
||||||
|
}
|
||||||
|
if (in_array(idate('i'), [5, 6, 15, 16, 25, 26, 35, 36, 45]) && $row['zv'] === 0) {
|
||||||
|
Db::sql('update users set ipreg = 0 where id = ?', [$row['id']]);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($row['zv'] === 0 && ($row['battle'] === 0 || empty($btltest[$row['battle']]) || $btltest[$row['battle']] < 1)) {
|
||||||
|
$btltest[$row['battle']]++;
|
||||||
|
Db::sql('update users set online = unix_timestamp(), afk = ? where id = ?', ['', $row['id']]);
|
||||||
|
BotLogic::start($row['id']);
|
||||||
|
} else {
|
||||||
|
Db::sql('update users set online = unix_timestamp() where id = ?', [$row['id']]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
18
_incl_data/crons/crontab.ini
Normal file
18
_incl_data/crons/crontab.ini
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
* * * * * /usr/local/bin/php -f /home/newcom1/public_html/cron_tower.php;
|
||||||
|
0 0 * * * /usr/local/bin/php -f /home/newcom1/public_html/cron/clear.php;
|
||||||
|
* * * * * /usr/local/bin/php -f /home/newcom1/public_html/cron_dungeon_goBots.php
|
||||||
|
0 1 * * * /usr/local/bin/php /home/newcom1/public_html/_incl_data/crons/bank_updateExchangeRares.php
|
||||||
|
20 */3 * * * /usr/local/bin/php /home/newcom1/public_html/_incl_data/crons/battle_clear.php
|
||||||
|
* * * * * /usr/local/bin/php /home/newcom1/public_html/_incl_data/crons/battle_finish.php
|
||||||
|
* * * * * /usr/local/bin/php /home/newcom1/public_html/_incl_data/crons/battle_start.php
|
||||||
|
10 1,2,8-23 * * * /usr/local/bin/php /home/newcom1/public_html/_incl_data/crons/battle_startPrizhaot.php
|
||||||
|
* * * * * /usr/local/bin/php /home/newcom1/public_html/_incl_data/crons/bot_calls.php
|
||||||
|
* * * * * /usr/local/bin/php /home/newcom1/public_html/_incl_data/crons/bot_core.php
|
||||||
|
0 12 * * 1 /usr/local/bin/php /home/newcom1/public_html/_incl_data/crons/cshop_returnToOwner.php
|
||||||
|
0 */6 * * * /usr/local/bin/php /home/newcom1/public_html/_incl_data/crons/cshop_sellToShop.php
|
||||||
|
0 */1 * * * /usr/local/bin/php /home/newcom1/public_html/_incl_data/crons/dungeon_clear.php
|
||||||
|
0 3 */1 * * /usr/local/bin/php /home/newcom1/public_html/_incl_data/crons/game_clear.php
|
||||||
|
0 */1 * * * /usr/local/bin/php /home/newcom1/public_html/_incl_data/crons/quests.php
|
||||||
|
0 0 * * * /usr/local/bin/php /home/newcom1/public_html/_incl_data/crons/rating_clans.php
|
||||||
|
0 0 * * * /usr/local/bin/php /home/newcom1/public_html/_incl_data/crons/rating_pers.php
|
||||||
|
*/15 * * * * /usr/local/bin/php /home/newcom1/public_html/_incl_data/crons/rupor.php
|
98
_incl_data/crons/cshop_returnToOwner.php
Normal file
98
_incl_data/crons/cshop_returnToOwner.php
Normal file
@ -0,0 +1,98 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Core\Db;
|
||||||
|
|
||||||
|
require_once dirname(__DIR__) . DIRECTORY_SEPARATOR . 'autoload.php';
|
||||||
|
|
||||||
|
/** Îïòèìèçèðîâàíî. Íî êàê-òî õåðîâàòî. Íàäî îòêàçàòüñÿ îò âûçîâà $u. È çàïðîñû êàêèå-òî âðàçíîáîé, íàäî ðàçáèðàòüñÿ.
|
||||||
|
* CRON Êîìèññèîííîãî ìàãàçèíà
|
||||||
|
* Åñëè ïðåäìåò âèñèò óæå 2 è áîëåå íåäåëü, ïðîäàâàòü ïðåäìåò çà 50% îò åãî ñòîèìîñòè ñ ó÷åòîì èçíîñà.
|
||||||
|
* Äåíüãè îòñûëàþòñÿ íà ïî÷òó.
|
||||||
|
* @author Insallah
|
||||||
|
* @todo ïðîâåðèòü íà êîíôëèêòû ñ cshop_sellToShop.
|
||||||
|
*/
|
||||||
|
|
||||||
|
# Êàæäûé ïîíåäåëüíèê â 12 äíÿ.
|
||||||
|
|
||||||
|
const RETURN_GROUP = '"<span style="color: #C65F00;">Shop.capitalcity</span>": Âîçâðàò èç êîìèññèîííîãî ìàãàçèíà ïðåäìåò: [id="%s"/ Íàçâàíèå : "%s"/ Öåíà : "%s"/ Ãðóïïèðîâêà : "$s"].';
|
||||||
|
const RETURN_ONE = '"<span style="color: #C65F00;">Shop.capitalcity</span>": Âîçâðàò èç êîìèññèîííîãî ìàãàçèíà ïðåäìåò: [id="%s"/ Íàçâàíèå : "%s"/ Öåíà : "%s"].';
|
||||||
|
const SHOP_TYPE = 'Shop.comission';
|
||||||
|
|
||||||
|
$u = User::start();
|
||||||
|
|
||||||
|
$q = 'select
|
||||||
|
items_main.id,
|
||||||
|
uid,
|
||||||
|
inGroup,
|
||||||
|
item_id,
|
||||||
|
price1,
|
||||||
|
name
|
||||||
|
from
|
||||||
|
items_users
|
||||||
|
left join items_main on items_main.id = item_id
|
||||||
|
where inShop = 30 and `delete` = 0';
|
||||||
|
|
||||||
|
|
||||||
|
foreach (Db::getRows($q) as $row) {
|
||||||
|
if ($row['inGroup']) {
|
||||||
|
$col = $u->itemsX($row['id']);
|
||||||
|
if ($col > 1) {
|
||||||
|
$stmt = Db::prepare('
|
||||||
|
update items_users set inShop = 0, 1price = ?
|
||||||
|
where
|
||||||
|
item_id = ? and
|
||||||
|
inShop = 30 and
|
||||||
|
uid = ? and
|
||||||
|
inGroup = ?
|
||||||
|
limit ' . $col);
|
||||||
|
if ($stmt->execute([$row['price1'], $row['item_id'], $row['uid'], $row['inGroup']])) {
|
||||||
|
$ld = $u->addDelo(
|
||||||
|
1,
|
||||||
|
$row['uid'],
|
||||||
|
sprintf(RETURN_GROUP, $row['item_id'], $row['name'], $row['price1'], $row['inGroup'] . '+1'),
|
||||||
|
time(),
|
||||||
|
$u->info['city'],
|
||||||
|
SHOP_TYPE,
|
||||||
|
0,
|
||||||
|
0
|
||||||
|
);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$stmt = Db::prepare('
|
||||||
|
update items_users set inShop = 0, 1price = ?
|
||||||
|
where
|
||||||
|
uid = ? and
|
||||||
|
id = ? and
|
||||||
|
inOdet = 0 and
|
||||||
|
`delete` = 0 and
|
||||||
|
inShop = 30
|
||||||
|
');
|
||||||
|
if ($stmt->execute([$row['price1'], $row['uid'], $row['id']])) {
|
||||||
|
$ld = $u->addDelo(
|
||||||
|
1,
|
||||||
|
$row['uid'],
|
||||||
|
sprintf(RETURN_ONE, $row['item_id'], $row['name'], $row['price1']),
|
||||||
|
time(),
|
||||||
|
$u->info['city'],
|
||||||
|
SHOP_TYPE,
|
||||||
|
0,
|
||||||
|
0
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$stmt = Db::prepare('update items_users set inShop = 0, 1price = ? where id = ? and inShop = 30');
|
||||||
|
if ($stmt->execute([$row['price1'], $row['id']])) {
|
||||||
|
$ld = $u->addDelo(
|
||||||
|
1,
|
||||||
|
$row['uid'],
|
||||||
|
sprintf(RETURN_ONE, $row['item_id'], $row['name'], $row['price1']),
|
||||||
|
time(),
|
||||||
|
$u->info['city'],
|
||||||
|
SHOP_TYPE,
|
||||||
|
0,
|
||||||
|
0
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1,4 +1,9 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
use Core\Db;
|
||||||
|
|
||||||
|
require_once dirname(__DIR__) . DIRECTORY_SEPARATOR . 'autoload.php';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* CRON Комиссионного магазина
|
* CRON Комиссионного магазина
|
||||||
* Если предмет висит уже 2 и более недель, продавать предмет за 50% от его стоимости с учетом износа.
|
* Если предмет висит уже 2 и более недель, продавать предмет за 50% от его стоимости с учетом износа.
|
||||||
@ -6,19 +11,20 @@
|
|||||||
*
|
*
|
||||||
* Примерно вот так должен выглядеть нормальный крон. Меньше левых зависимостей, нет подтягиванию половины движка.
|
* Примерно вот так должен выглядеть нормальный крон. Меньше левых зависимостей, нет подтягиванию половины движка.
|
||||||
* Всё ещё не идеально, но уже неплохо.
|
* Всё ещё не идеально, но уже неплохо.
|
||||||
|
*
|
||||||
|
* Запуск раз в минуту.
|
||||||
|
*
|
||||||
* @author Ivor Barhansky <me@lopar.space>
|
* @author Ivor Barhansky <me@lopar.space>
|
||||||
|
* @todo проверить на конфликты с cshop_returnToOwner.
|
||||||
|
* @todo Вернуть запросы взад и вывести их из циклов. "нормальный крон", ёпт, под какими веществами я это делал?
|
||||||
*/
|
*/
|
||||||
|
|
||||||
use Insallah\Db;
|
|
||||||
|
|
||||||
const GAME = true;
|
|
||||||
const TIME_LAST = 86400; // 1 day
|
const TIME_LAST = 86400; // 1 day
|
||||||
const AUC = '<span style="color: #009966;">Филиал Аукциона</span>';
|
const AUC = '<span style="color: #009966;">Филиал Аукциона</span>';
|
||||||
const AUC_WIN = 'Вы выиграли торги. Предмет "%s" за <b>%s кр.</b> был добавлен к вам в инвентарь.';
|
const AUC_WIN = 'Вы выиграли торги. Предмет "%s" за <b>%s кр.</b> был добавлен к вам в инвентарь.';
|
||||||
const AUC_SELL = 'Предмет "%s" был продан на торгах, <b>%s</b> кр. за товар отправлены вам по почте.';
|
const AUC_SELL = 'Предмет "%s" был продан на торгах, <b>%s</b> кр. за товар отправлены вам по почте.';
|
||||||
const AUC_SELL_LOG = 'Филиал Аукциона: Предмет "%s" был продан за <b>%s кр</b>.';
|
const AUC_SELL_LOG = 'Филиал Аукциона: Предмет "%s" был продан за <b>%s кр</b>.';
|
||||||
const AUC_NOT_SELL = 'Предмет "%s" не был продан, он возвращен вам в инвентарь.';
|
const AUC_NOT_SELL = 'Предмет "%s" не был продан, он возвращен вам в инвентарь.';
|
||||||
require_once '_incl_data/class/Insallah/Core/Db.php';
|
|
||||||
|
|
||||||
$query = [ //all queries
|
$query = [ //all queries
|
||||||
'insert into chat (new, login, `to`, text, time, type) values (1, ?, ?, ?, unix_timestamp(), 6)',
|
'insert into chat (new, login, `to`, text, time, type) values (1, ?, ?, ?, unix_timestamp(), 6)',
|
80
_incl_data/crons/dungeon_clear.php
Normal file
80
_incl_data/crons/dungeon_clear.php
Normal file
@ -0,0 +1,80 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Core\Db;
|
||||||
|
|
||||||
|
require_once dirname(__DIR__) . DIRECTORY_SEPARATOR . 'autoload.php';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ñêðèïò îòâå÷àåò çà ÷èñòêó ïåùåð êîòîðûå íå èñïîëüçóþòñÿ èãðîêîì â òå÷åíèè 3 ÷àñîâ
|
||||||
|
* ïðè ó÷åòå ÷òî ïåùåðå áîëüøå 5 ÷àñîâ îò âðåìåíè ñîçäàíèÿ.
|
||||||
|
*
|
||||||
|
* Çàïóñê ðàç â ìèíóòó.
|
||||||
|
* (3 ÷àñà îôôëàéíà íà 5 ÷àñîâ ñóùåñòâîâàíèÿ, çà÷åì òóò ïîìèíóòêà?)
|
||||||
|
*/
|
||||||
|
|
||||||
|
# Âûáèðàåì ïåùåðó (ÈÄ, ÃÎÐÎÄ), ãäå:
|
||||||
|
# Èãðîê â ïåùåðå
|
||||||
|
# Èãðîê îôôëàéí áîëåå 3õ ÷àñîâ
|
||||||
|
# Ïåùåðà çàïóùåíà áîëåå 3õ ÷àñîâ íàçàä
|
||||||
|
# Âðåìÿ ïåùåðû âûøëî (?!)
|
||||||
|
# ??? bsid
|
||||||
|
|
||||||
|
$dungeons = Db::getRows(
|
||||||
|
'
|
||||||
|
select
|
||||||
|
dungeon_now.city,
|
||||||
|
dungeon_now.id as did
|
||||||
|
from
|
||||||
|
dungeon_now
|
||||||
|
left join users on dungeon_now.id = users.id
|
||||||
|
left join stats on dungeon_now.id = stats.id
|
||||||
|
where
|
||||||
|
stats.dnow > 0 and
|
||||||
|
users.online < unix_timestamp() - 10800 and
|
||||||
|
dungeon_now.time_start < unix_timestamp() - 10800 and
|
||||||
|
dungeon_now.time_finish = 0 and
|
||||||
|
dungeon_now.bsid = 0
|
||||||
|
group by dungeon_now.id order by dungeon_now.id desc
|
||||||
|
'
|
||||||
|
);
|
||||||
|
|
||||||
|
foreach ($dungeons as $dungeon) {
|
||||||
|
if (!$dungeon['did'] || $dungeon['did'] === 15) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
# [1] Âûêèäûâàåì èãðîêîâ ñ ïîäçåìåëüÿ è ïåðåìåùàåì åãî â `382` ïîäâàëüíîå ïîìåùåíèå
|
||||||
|
|
||||||
|
$podvalRoom = 382;
|
||||||
|
if ($dungeon['city'] === 'capitalcity') {
|
||||||
|
$podvalRoom = 321;
|
||||||
|
} elseif ($dungeon['city'] === 'angelscity') {
|
||||||
|
$podvalRoom = 242;
|
||||||
|
}
|
||||||
|
|
||||||
|
Db::sql('update stats set dnow = 0 where id in (select id from stats where dnow = ? limit 10)', [$dungeon['did']]);
|
||||||
|
# Âûáðîñèëè èãðîêà ñ ïîäçåìåëüÿ è ïåðåìåñòèëè â ïîäâàëüíîå ïîìåùåíèå
|
||||||
|
Db::sql(
|
||||||
|
'update users set room = ? where id in (select id from stats where dnow = ? limit 10)',
|
||||||
|
[$podvalRoom, $dungeon['did']]
|
||||||
|
);
|
||||||
|
# Âûáðàñûâàåì ïåùåðíûå ïðåäìåòû ó èãðîêà
|
||||||
|
Db::sql(
|
||||||
|
'update items_users set `delete` = unix_timestamp() where dn_delete = 1 and uid in (select id from stats where dnow = ? limit 10)',
|
||||||
|
[$dungeon['did']]
|
||||||
|
);
|
||||||
|
|
||||||
|
# [2] Óäàëÿåì îáúåêòû.
|
||||||
|
Db::sql('delete from dungeon_obj where for_dn = 0 and dn = ?', [$dungeon['did']]);
|
||||||
|
|
||||||
|
# [3] Óäàëÿåì ìîíñòðîâ.
|
||||||
|
Db::sql('delete from dungeon_bots where for_dn = 0 and dn = ?', [$dungeon['did']]);
|
||||||
|
|
||||||
|
# [4] Óäàëÿåì ïðåäìåòû.
|
||||||
|
Db::sql('delete from dungeon_items where for_dn = 0 and dn = ?', [$dungeon['did']]);
|
||||||
|
|
||||||
|
# [5] Óäàëÿåì äåéñòâèÿ (actions)
|
||||||
|
Db::sql('delete from dungeon_actions where dn = ?', [$dungeon['did']]);
|
||||||
|
|
||||||
|
# [6] Çàêðûâàåì Ïîäçåìåëüå Dungeon_Now - time_finish = time();
|
||||||
|
Db::sql('update dungeon_now set time_finish = unix_timestamp() where id = ?', [$dungeon['did']]);
|
||||||
|
}
|
78
_incl_data/crons/game_clear.php
Normal file
78
_incl_data/crons/game_clear.php
Normal file
@ -0,0 +1,78 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Core\Db;
|
||||||
|
|
||||||
|
require_once dirname(__DIR__) . DIRECTORY_SEPARATOR . 'autoload.php';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* CRON Очистки сервера от ненужной информации
|
||||||
|
* Каждый день в 3 часа 15 минут.
|
||||||
|
*/
|
||||||
|
|
||||||
|
# DAY: 86400
|
||||||
|
|
||||||
|
function getIds($query): string
|
||||||
|
{
|
||||||
|
return implode(',', Db::getColumn($query));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Заявки в клан
|
||||||
|
Db::sql('update users set clan_zv = 0 where clan_zv > 0');
|
||||||
|
// Очистка чата, остается 30 минут.
|
||||||
|
Db::sql('delete from chat where time < unix_timestamp() - 1800');
|
||||||
|
Db::sql('delete from chat_system where time < unix_timestamp() - 1800');
|
||||||
|
// Очистка заявок в поединки
|
||||||
|
Db::sql('delete from zayvki where start > 0 or cancel > 0 or time < unix_timestamp() - 43200');
|
||||||
|
// Очистка заявок в пещеры
|
||||||
|
Db::sql('delete from dungeon_zv where `delete` > 0 or time < unix_timestamp() - 43200');
|
||||||
|
|
||||||
|
// Очистка походов
|
||||||
|
$uids = getIds('select id from dungeon_now where time_start < unix_timestamp() - 43200 or time_finish > 0');
|
||||||
|
Db::sql('delete from dungeon_actions where dn in (?)', [$uids]);
|
||||||
|
Db::sql('delete from dungeon_bots where dn in (?)', [$uids]);
|
||||||
|
Db::sql('delete from dungeon_items where dn in (?)', [$uids]);
|
||||||
|
Db::sql('delete from dungeon_obj where dn in (?)', [$uids]);
|
||||||
|
Db::sql('delete from dungeon_now where id in (?)', [$uids]);
|
||||||
|
unset($uids);
|
||||||
|
|
||||||
|
// Очистка банов (10 дней) и отсутствующих (30 дней) и "явных ботов"
|
||||||
|
$uids = getIds(
|
||||||
|
'select id from users where
|
||||||
|
banned between 1 and unix_timestamp() - 86400 * 10 or
|
||||||
|
level < 10 and admin = 0 and online between 1 and unix_timestamp() - 86400 * 30 or
|
||||||
|
ip = 0 and online = 0 and battle = 0
|
||||||
|
'
|
||||||
|
);
|
||||||
|
Db::sql('delete from items_users where uid in (?)', [$uids]);
|
||||||
|
Db::sql('delete from eff_users where uid in (?)', [$uids]);
|
||||||
|
Db::sql('delete from users where id in (?)', [$uids]);
|
||||||
|
Db::sql('delete from rep where id in (?)', [$uids]);
|
||||||
|
Db::sql('delete from stats where id in (?)', [$uids]);
|
||||||
|
Db::sql('delete from online where uid in (?)', [$uids]);
|
||||||
|
Db::sql('delete from actions where uid in (?)', [$uids]);
|
||||||
|
unset($uids);
|
||||||
|
|
||||||
|
// Прочее
|
||||||
|
$uids = getIds('select id from users');
|
||||||
|
Db::sql('delete from items_users where uid > 0 and uid not in (?)', [$uids]);
|
||||||
|
Db::sql('delete from eff_users where uid > 0 and uid not in (?)', [$uids]);
|
||||||
|
Db::sql('delete from users_achiv where id > 0 and id not in (?)', [$uids]);
|
||||||
|
Db::sql('delete from aaa_bonus where uid > 0 and uid not in (?)', [$uids]);
|
||||||
|
Db::sql('delete from users_delo where uid > 0 and uid not in (?) or time < unix_timestamp() - 86400 * 10', [$uids]);
|
||||||
|
Db::sql('delete from users_reting where uid > 0 and uid not in (?)', [$uids]);
|
||||||
|
Db::sql('delete from aaa_reting_list where uid > 0 and uid not in (?)', [$uids]);
|
||||||
|
Db::sql('delete from rep where id > 0 and id not in (?)', [$uids]);
|
||||||
|
Db::sql('delete from aaa_znahar where uid > 0 and uid not in (?)', [$uids]);
|
||||||
|
Db::sql('delete from user_operation where uid > 0 and uid not in (?)', [$uids]);
|
||||||
|
Db::sql(
|
||||||
|
'delete from actions where
|
||||||
|
uid > 0 and uid not in (?) or
|
||||||
|
vars = ? or
|
||||||
|
vals = ? or
|
||||||
|
vars != ? and time < unix_timestamp() - 86400 * 60',
|
||||||
|
[$uids, 'day_quest', 'loto', 'read']
|
||||||
|
);
|
||||||
|
unset($uids);
|
||||||
|
|
||||||
|
// Голосовые сообщения
|
||||||
|
Db::sql('delete from uploads where id > 0');
|
80
_incl_data/crons/quests.php
Normal file
80
_incl_data/crons/quests.php
Normal file
@ -0,0 +1,80 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Core\Db;
|
||||||
|
|
||||||
|
require_once dirname(__DIR__) . DIRECTORY_SEPARATOR . 'autoload.php';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Что-то для квестов.
|
||||||
|
* Вызов раз в час
|
||||||
|
*/
|
||||||
|
|
||||||
|
$data = Db::getRows('select id, battle, room from users where `real` = 1');
|
||||||
|
foreach ($data as $row) {
|
||||||
|
$bot_kill = [];
|
||||||
|
$delete = '';
|
||||||
|
|
||||||
|
$qp = Db::getColumn(
|
||||||
|
'select vars from actions where uid = ? and vars like ? and vals = ?',
|
||||||
|
[
|
||||||
|
$row['id'],
|
||||||
|
'%start_quest%',
|
||||||
|
'go',
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
foreach ($qp as $item) {
|
||||||
|
$qst_id = str_replace('start_quest', '', $item);
|
||||||
|
$qst = Db::getValue('select act_date from quests where id = ?', [$qst_id]);
|
||||||
|
if (!$qst) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
$act = explode(':|:', $qst);
|
||||||
|
foreach ($act as $item2) {
|
||||||
|
$act2 = explode(':=:', $item2);
|
||||||
|
$bots = explode(',', $act2[1]);
|
||||||
|
foreach ($bots as $item3) {
|
||||||
|
$bot = explode('=', $item3);
|
||||||
|
$bot_kill[$bot[0]] = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$wp = Db::getRows(
|
||||||
|
'select id, vars from actions where uid = ? and (vars like ? or vars like ? or vars like ?)',
|
||||||
|
[
|
||||||
|
$row['id'],
|
||||||
|
'win_bot_%',
|
||||||
|
'lose_bot_%',
|
||||||
|
'nich_bot_%',
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
foreach ($wp as $item) {
|
||||||
|
$wlb = str_replace(['win_bot_', 'lose_bot_', 'nich_bot_',], '', $item);
|
||||||
|
if ($bot_kill[$wlb]) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
$delete .= "or id = $item";
|
||||||
|
}
|
||||||
|
|
||||||
|
$delete = ltrim($delete, 'or ');
|
||||||
|
if (!empty($delete)) {
|
||||||
|
$query = 'delete from actions where ' . $delete;
|
||||||
|
Db::sql($query);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($row['battle'] !== 0) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
Db::sql(
|
||||||
|
'delete from actions where uid = ? and (vars like ? or vars like ? or vars like ? and room != ?)',
|
||||||
|
[
|
||||||
|
$row['id'],
|
||||||
|
'%use_priem_%',
|
||||||
|
'%animal_use%',
|
||||||
|
'%takeit_%',
|
||||||
|
$row['room'],
|
||||||
|
]
|
||||||
|
);
|
||||||
|
}
|
126
_incl_data/crons/rating_clans.php
Normal file
126
_incl_data/crons/rating_clans.php
Normal file
@ -0,0 +1,126 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Core\Db;
|
||||||
|
|
||||||
|
require_once dirname(__DIR__) . DIRECTORY_SEPARATOR . 'autoload.php';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Îáíîâèòü ðåéòèíã êëàíîâ.
|
||||||
|
* Ðàç â äåíü.
|
||||||
|
*/
|
||||||
|
|
||||||
|
$add_exp_list = [];
|
||||||
|
$all_exp_list = [];
|
||||||
|
$exp_list = [];
|
||||||
|
$win_list = [];
|
||||||
|
$lose_list = [];
|
||||||
|
$nich_list = [];
|
||||||
|
$xu_list = [];
|
||||||
|
$level_list = [];
|
||||||
|
$log_list = [];
|
||||||
|
|
||||||
|
$clans = Db::getRows(
|
||||||
|
'
|
||||||
|
select
|
||||||
|
clan.id as cid,
|
||||||
|
clan.level,
|
||||||
|
clan.name,
|
||||||
|
count(*) as ucount,
|
||||||
|
clan.exp,
|
||||||
|
stats.id as sid,
|
||||||
|
sum(users.win) as win,
|
||||||
|
sum(users.lose) as lose,
|
||||||
|
sum(users.nich) as nich,
|
||||||
|
aaa_clan_reting_list.global
|
||||||
|
from
|
||||||
|
clan
|
||||||
|
left join users on clan.id = users.clan
|
||||||
|
left join stats on users.id = stats.id
|
||||||
|
left join aaa_clan_reting_list on aaa_clan_reting_list.clan = clan.id
|
||||||
|
where clan.id not in (62, 93) and users.admin = 0 and users.`real` = 1
|
||||||
|
'
|
||||||
|
);
|
||||||
|
|
||||||
|
foreach ($clans as $clan) {
|
||||||
|
$add_exp = 0;
|
||||||
|
$add_exp_list[$clan['cid']] = 0;
|
||||||
|
$all_exp_list[$clan['cid']] = 0;
|
||||||
|
$log_list[$clan['cid']] = $clan['name'];
|
||||||
|
$level_list[$clan['cid']] = $clan['level'];
|
||||||
|
$xu_list[$clan['cid']] = $clan['ucount'];
|
||||||
|
$exp_list[$clan['cid']] = $clan['exp'];
|
||||||
|
$win_list[$clan['cid']] = $clan['win'];
|
||||||
|
$lose_list[$clan['cid']] = $clan['lose'];
|
||||||
|
$nich_list[$clan['cid']] = $clan['nich'];
|
||||||
|
|
||||||
|
$clanMemberStats = Db::getRows(
|
||||||
|
'select
|
||||||
|
stats.id,
|
||||||
|
repexp
|
||||||
|
from
|
||||||
|
stats
|
||||||
|
left join users on users.id = stats.id
|
||||||
|
where clan = ?',
|
||||||
|
[$clan['cid']]
|
||||||
|
);
|
||||||
|
|
||||||
|
foreach ($clanMemberStats as $stat) {
|
||||||
|
$add_exp += $stat['repexp'];
|
||||||
|
Db::sql('update stats set repexp = 0 where id = ?', [$stat['id']]);
|
||||||
|
}
|
||||||
|
|
||||||
|
$global_exp = idate('d') != 1 ? round($clan['global']) : 0;
|
||||||
|
if ($clan['ucount'] > 0) {
|
||||||
|
$add_exp_list[$clan['cid']] = $add_exp; //çàïèñûâàåì ñêîëüêî îïûòà ïîëó÷èë çà ñåãîäíÿ
|
||||||
|
$all_exp_list[$clan['cid']] = $global_exp + $add_exp; //çàïèñûâàåì ñêîëüêî îïûòà ïîëó÷èë âñåãî + ñåãîäíÿøíèé
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
arsort($all_exp_list);
|
||||||
|
|
||||||
|
$keys = array_keys($all_exp_list);
|
||||||
|
|
||||||
|
$i = 0;
|
||||||
|
foreach ($keys as $key) {
|
||||||
|
$i++;
|
||||||
|
if (!$key) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
Db::sql(
|
||||||
|
'insert into aaa_clan_reting_list (level, xu, win, lose, nich, exp_real, clan, pos, global, exp, date, time) values (?,?,?,?,?,?,?,?,?,?,?,unix_timestamp())',
|
||||||
|
[
|
||||||
|
$level_list[$key],
|
||||||
|
$xu_list[$key],
|
||||||
|
$win_list[$key],
|
||||||
|
$lose_list[$key],
|
||||||
|
$nich_list[$key],
|
||||||
|
$exp_list[$key],
|
||||||
|
$key,
|
||||||
|
$i,
|
||||||
|
$all_exp_list[$key],
|
||||||
|
$add_exp_list[$key],
|
||||||
|
date('dmY'),
|
||||||
|
]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
$stmt = Db::prepare('update clan set money2 = money2 + ? where id = ?');
|
||||||
|
$stmt->execute([$xu_list[0] * 0.3, $keys[0]]);
|
||||||
|
$stmt->execute([$xu_list[1] * 0.2, $keys[1]]);
|
||||||
|
$stmt->execute([$xu_list[2] * 0.1, $keys[2]]);
|
||||||
|
|
||||||
|
Db::sql(
|
||||||
|
'insert into chat (text, city, type, new, time) values
|
||||||
|
(?,\'capitalcity\',6,1,unix_timestamp()),
|
||||||
|
(?,\'capitalcity\',6,1,unix_timestamp()),
|
||||||
|
(?,\'capitalcity\',6,1,unix_timestamp()),
|
||||||
|
(?,\'capitalcity\',6,1,unix_timestamp())',
|
||||||
|
[
|
||||||
|
'<span style="color: red; font-weight: bold;">Ðåéòèíã êëàíîâ ' . date('d-m-Y') . ' </span>',
|
||||||
|
'Êëàí ' . $log_list[0] . ' ïîëó÷àåò ' . $xu_list[0] * 0.3 . ' Åêð. â êàçíó êëàíà çà 1-å ìåñòî â ðåéòèíãå!',
|
||||||
|
'Êëàí ' . $log_list[1] . ' ïîëó÷àåò ' . $xu_list[1] * 0.2 . ' Åêð. â êàçíó êëàíà çà 2-å ìåñòî â ðåéòèíãå!',
|
||||||
|
'Êëàí ' . $log_list[2] . ' ïîëó÷àåò ' . $xu_list[2] * 0.1 . ' Åêð. â êàçíó êëàíà çà 3-å ìåñòî â ðåéòèíãå!',
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
Db::sql('update stats set repexp = 0 where repexp > 0');
|
133
_incl_data/crons/rating_pers.php
Normal file
133
_incl_data/crons/rating_pers.php
Normal file
@ -0,0 +1,133 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Core\Db;
|
||||||
|
|
||||||
|
require_once dirname(__DIR__) . DIRECTORY_SEPARATOR . 'autoload.php';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Îáíîâèòü ðåéòèíã èãðîêîâ.
|
||||||
|
* Ðàç â äåíü.
|
||||||
|
*/
|
||||||
|
|
||||||
|
//Ðåéòèíã ïî âêëàäàì
|
||||||
|
$ub = [];
|
||||||
|
$ui = [];
|
||||||
|
|
||||||
|
$payOperations = Db::getRows('select * from pay_operation where good > 0 order by id desc');
|
||||||
|
foreach ($payOperations as $operation) {
|
||||||
|
if (!isset($ub[$operation['uid']])) {
|
||||||
|
$ui[] = $operation['uid'];
|
||||||
|
}
|
||||||
|
$ub[$operation['uid']][date('d.m.Y', $operation['good'])] = $operation['ekr'];
|
||||||
|
}
|
||||||
|
|
||||||
|
// ×ÒÎ ÒÛ ÁËßÒÜ ÒÀÊÎÅ?!
|
||||||
|
foreach ($ui as $item) {
|
||||||
|
if (!$item) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
$k = 0;
|
||||||
|
$nj = 0;
|
||||||
|
for ($i = 0; $i <= 1000; $i++) {
|
||||||
|
$date = date('d.m.Y', time() - (86400 * $i));
|
||||||
|
if (isset($ub[$item][$date])) {
|
||||||
|
$k++;
|
||||||
|
$nj = 0;
|
||||||
|
} elseif ($i > 0 && $nj >= 6) {
|
||||||
|
$j = 1000;
|
||||||
|
} else {
|
||||||
|
$nj++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Db::sql('replace into users_paybonus (id, level) values (?,?)', [$item, $k]);
|
||||||
|
}
|
||||||
|
|
||||||
|
$log_list = [];
|
||||||
|
$add_exp_list = [];
|
||||||
|
$all_exp_list = [];
|
||||||
|
$exp_list = [];
|
||||||
|
$win_list = [];
|
||||||
|
$global_exp = 0;
|
||||||
|
|
||||||
|
Db::sql('delete from aaa_reting_list where date = ?', [date('dmY')]);
|
||||||
|
|
||||||
|
$users = Db::getRows(
|
||||||
|
'
|
||||||
|
select
|
||||||
|
stats.id,
|
||||||
|
login,
|
||||||
|
users.win as uwin,
|
||||||
|
stats.exp as sexp,
|
||||||
|
repexp,
|
||||||
|
aaa_reting_list.exp as aexp,
|
||||||
|
global,
|
||||||
|
exp_real
|
||||||
|
from users
|
||||||
|
left join stats on stats.id = users.id
|
||||||
|
left join aaa_reting_list on users.id = uid
|
||||||
|
where `real` = 1 and admin = 0 and bot = 0
|
||||||
|
'
|
||||||
|
);
|
||||||
|
foreach ($users as $user) {
|
||||||
|
$exp_list[$user['id']] = $user['sexp'];
|
||||||
|
$win_list[$user['id']] = $user['uwin'];
|
||||||
|
$log_list[$user['id']] = $user['login'];
|
||||||
|
$add_exp = $user['sexp'];
|
||||||
|
|
||||||
|
if (idate('d') !== 1) { //çíà÷åíèå ðåéòèíãà îáíóëÿåòñÿ 1ãî ÷èñëà
|
||||||
|
$global_exp = round($user['global']);
|
||||||
|
}
|
||||||
|
|
||||||
|
$global_exp = $global_exp + round($user['repexp']);
|
||||||
|
$add_exp_list[$user['id']] = $add_exp; //çàïèñûâàåì ñêîëüêî îïûòà ïîëó÷èë çà ñåãîäíÿ
|
||||||
|
$all_exp_list[$user['id']] = $global_exp;// + $add_exp; //çàïèñûâàåì ñêîëüêî îïûòà ïîëó÷èë âñåãî + ñåãîäíÿøíèé
|
||||||
|
}
|
||||||
|
|
||||||
|
arsort($all_exp_list);
|
||||||
|
|
||||||
|
$keys = array_keys($all_exp_list);
|
||||||
|
|
||||||
|
$i = 0;
|
||||||
|
foreach ($keys as $key) {
|
||||||
|
if (!$key) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
$i++;
|
||||||
|
Db::sql(
|
||||||
|
'insert into aaa_reting_list (uid, pos, global, exp, exp_real, date, time, win) values (?,?,?,?,?,?,unix_timestamp(),?)',
|
||||||
|
[
|
||||||
|
$key,
|
||||||
|
$i,
|
||||||
|
$all_exp_list[$key],
|
||||||
|
$add_exp_list[$key],
|
||||||
|
$exp_list[$key],
|
||||||
|
date('dmY'),
|
||||||
|
$win_list[$key],
|
||||||
|
]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
$stmt = Db::prepare('update users set money2 = money2 + ? where id = ?');
|
||||||
|
$stmt->execute([1, $keys[0]]);
|
||||||
|
$stmt->execute([0.75, $keys[1]]);
|
||||||
|
$stmt->execute([0.5, $keys[2]]);
|
||||||
|
$stmt->execute([0.25, $keys[3]]);
|
||||||
|
$stmt->execute([0.15, $keys[4]]);
|
||||||
|
|
||||||
|
Db::sql(
|
||||||
|
'insert into chat (text, city, type, new, time) values
|
||||||
|
(?,\'capitalcity\',6,1,unix_timestamp()),
|
||||||
|
(?,\'capitalcity\',6,1,unix_timestamp()),
|
||||||
|
(?,\'capitalcity\',6,1,unix_timestamp()),
|
||||||
|
(?,\'capitalcity\',6,1,unix_timestamp()),
|
||||||
|
(?,\'capitalcity\',6,1,unix_timestamp()),
|
||||||
|
(?,\'capitalcity\',6,1,unix_timestamp())',
|
||||||
|
[
|
||||||
|
'<span style="color: red; font-weight: bold;">Ðåéòèíã èãðîêîâ ' . date('d-m-Y') . ' </span>',
|
||||||
|
'Èãðîê ' . $log_list[0] . ' ïîëó÷àåò 1 Åêð. çà 1-å ìåñòî â ðåéòèíãå!',
|
||||||
|
'Èãðîê ' . $log_list[1] . ' ïîëó÷àåò 0.75 Åêð. çà 2-å ìåñòî â ðåéòèíãå!',
|
||||||
|
'Èãðîê ' . $log_list[2] . ' ïîëó÷àåò 0.5 Åêð. çà 3-å ìåñòî â ðåéòèíãå!',
|
||||||
|
'Èãðîê ' . $log_list[3] . ' ïîëó÷àåò 0.25 Åêð. çà 4-å ìåñòî â ðåéòèíãå!',
|
||||||
|
'Èãðîê ' . $log_list[4] . ' ïîëó÷àåò 0.15 Åêð. çà 5-å ìåñòî â ðåéòèíãå!',
|
||||||
|
]
|
||||||
|
);
|
@ -1,12 +1,13 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/** Îïòèìèçèðîâàíî.
|
use Core\Db;
|
||||||
* @var PDO $pdo
|
|
||||||
* @author Insallah
|
require_once dirname(__DIR__) . DIRECTORY_SEPARATOR . 'autoload.php';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ęđč÷ŕëęŕ â ÷ŕň.
|
||||||
|
* Đŕç â 15 ěčíóň.
|
||||||
*/
|
*/
|
||||||
const GAME = true;
|
|
||||||
setlocale(LC_CTYPE, "ru_RU.CP1251");
|
|
||||||
require_once('/home/newcom1/public_html/_incl_data/class/__db_connect.php');
|
|
||||||
|
|
||||||
$rupor = [
|
$rupor = [
|
||||||
'Открыв новости, справа можно найти игровые статьи, которые помогут Вам разобраться в игре и сделать её в разы проще.',
|
'Открыв новости, справа можно найти игровые статьи, которые помогут Вам разобраться в игре и сделать её в разы проще.',
|
||||||
@ -20,5 +21,8 @@ $rupor = [
|
|||||||
];
|
];
|
||||||
|
|
||||||
shuffle($rupor);
|
shuffle($rupor);
|
||||||
$q = 'insert into chat (new, text, time, type, da, color) values (1, ?, unix_timestamp(), 6, 1, ?)';
|
|
||||||
$pdo->prepare($q)->execute(['Àäìèíèñòðàöèÿ: ' . $rupor[0], '#F00']);
|
Db::sql('insert into chat (new, text, time, type, da, color) values (1, ?, unix_timestamp(), 6, 1, ?)', [
|
||||||
|
'Ŕäěčíčńňđŕöč˙: ' . $rupor[0],
|
||||||
|
'#F00'
|
||||||
|
]);
|
@ -1,8 +1,9 @@
|
|||||||
<?php
|
<?php
|
||||||
define('GAME',true);
|
|
||||||
setlocale(LC_CTYPE ,"ru_RU.CP1251");
|
# Êàæäóþ ïîëíî÷ü
|
||||||
include('_incl_data/__config.php');
|
|
||||||
include('_incl_data/class/__db_connect.php');
|
const GAME = true;
|
||||||
|
include('/home/newcom1/public_html/_incl_data/class/__db_connect.php');
|
||||||
|
|
||||||
if( isset($_GET['actions']) ) {
|
if( isset($_GET['actions']) ) {
|
||||||
//
|
//
|
||||||
@ -39,6 +40,9 @@ if( isset($_GET['actions']) ) {
|
|||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
// ÅÁÈÈÈÈÈÈÈ×ÅÑÊÀß ÑÈÈÈÈËÀ!!!!! (ñ) Èíñ.
|
||||||
|
// forign_keys! Íèêòî íå çíàåò ïðî foreign_keys!
|
||||||
|
|
||||||
function delete_user_all( $uid , $login ) {
|
function delete_user_all( $uid , $login ) {
|
||||||
mysql_query('DELETE FROM `aaa_birthday` WHERE `uid` = "'.$uid.'"');
|
mysql_query('DELETE FROM `aaa_birthday` WHERE `uid` = "'.$uid.'"');
|
||||||
mysql_query('DELETE FROM `aaa_bonus` WHERE `uid` = "'.$uid.'"');
|
mysql_query('DELETE FROM `aaa_bonus` WHERE `uid` = "'.$uid.'"');
|
||||||
@ -120,7 +124,7 @@ function delete_user_all( $uid , $login ) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//1. Î÷èñòêà ÷àòà, îñòàåòñÿ ÷àò òîëüêî çà ïîñëåäíèå 3 äíÿ
|
//1. Î÷èñòêà ÷àòà, îñòàåòñÿ ÷àò òîëüêî çà ïîñëåäíèå 3 äíÿ
|
||||||
mysql_query('DELETE FROM `chat` WHERE `time` < '.(time()-86400*1).'');
|
mysql_query('DELETE FROM `chat` WHERE `time` < '.(time()-86400*3).'');
|
||||||
|
|
||||||
//2. Î÷èñòêà çàÿâîê â ïîåäèíêè
|
//2. Î÷èñòêà çàÿâîê â ïîåäèíêè
|
||||||
mysql_query('DELETE FROM `zayvki` WHERE `start` > 0 OR `cancel` > 0 OR `time` < "'.(time()-86400*1).'"');
|
mysql_query('DELETE FROM `zayvki` WHERE `start` > 0 OR `cancel` > 0 OR `time` < "'.(time()-86400*1).'"');
|
||||||
@ -140,7 +144,7 @@ while( $pl = mysql_fetch_array($sp) ) {
|
|||||||
|
|
||||||
//5. Î÷èñòêà ìîíñòðîâ
|
//5. Î÷èñòêà ìîíñòðîâ
|
||||||
$i = 0;
|
$i = 0;
|
||||||
$sp = mysql_query('SELECT * FROM `users` WHERE `real` = 0 ORDER BY `id` LIMIT 100000');
|
$sp = mysql_query('SELECT * FROM `users` WHERE `real` = 0 ORDER BY `id` ASC LIMIT 100');
|
||||||
while( $pl = mysql_fetch_array($sp) ) {
|
while( $pl = mysql_fetch_array($sp) ) {
|
||||||
$btl = mysql_fetch_array(mysql_query('SELECT * FROM `battle` WHERE `id` = "'.$pl['battle'].'" LIMIT 1'));
|
$btl = mysql_fetch_array(mysql_query('SELECT * FROM `battle` WHERE `id` = "'.$pl['battle'].'" LIMIT 1'));
|
||||||
$clon = mysql_fetch_array(mysql_query('SELECT `id` FROM `users` WHERE `inUser` = "'.$pl['id'].'" LIMIT 1'));
|
$clon = mysql_fetch_array(mysql_query('SELECT `id` FROM `users` WHERE `inUser` = "'.$pl['id'].'" LIMIT 1'));
|
||||||
@ -157,4 +161,8 @@ mysql_query('DELETE FROM `stats` WHERE `id` NOT IN (SELECT `id` FROM `users`);')
|
|||||||
mysql_query('DELETE FROM `items_users` WHERE `delete` > `time_create` AND `delete` > 0');
|
mysql_query('DELETE FROM `items_users` WHERE `delete` > `time_create` AND `delete` > 0');
|
||||||
|
|
||||||
//6. Î÷èñòêà ëè÷íîãî äåëà
|
//6. Î÷èñòêà ëè÷íîãî äåëà
|
||||||
mysql_query('DELETE FROM `users_delo` WHERE `time` < "'.(time()-86400*30).'" LIMIT 10000');
|
mysql_query('DELETE FROM `users_delo` WHERE `time` < "'.(time()-86400*30).'" LIMIT 1000');
|
||||||
|
|
||||||
|
//7. ñáðîñ ñ÷åò÷èêà æåòîíîâ
|
||||||
|
mysql_query('UPDATE `users` SET `ang_g` = 0 WHERE `ang_g` > 0');
|
||||||
|
|
494
_incl_data/crons/undone/cron_dungeon_goBots.php
Normal file
494
_incl_data/crons/undone/cron_dungeon_goBots.php
Normal file
@ -0,0 +1,494 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ñêðèïò îòâå÷àåò çà ïåðåìåùåíèÿ áîòîâ ïî ïåùåðå è íàïåäåíèÿ, êîãäà èãðîê ðÿäîì.
|
||||||
|
*
|
||||||
|
* Çàïóñê ðàç â ìèíèòó
|
||||||
|
*/
|
||||||
|
|
||||||
|
require_once dirname(__DIR__) . DIRECTORY_SEPARATOR . 'autoload.php';
|
||||||
|
|
||||||
|
//todo: IN PROGRESS
|
||||||
|
|
||||||
|
# Ñîâåðøàåì äåéñòâèå -> Íàïàäåíèå íà èãðîêà.
|
||||||
|
function botAttack($bot, $user)
|
||||||
|
{
|
||||||
|
if ($user['userBattle'] > 0) {
|
||||||
|
$battleID = mysql_fetch_array(
|
||||||
|
mysql_query(
|
||||||
|
'SELECT `id` FROM `battle` WHERE `id` = "' . $user['userBattle'] . '" AND `team_win` = "-1" LIMIT 1'
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
if (!isset($battleID['id'])) { //Ñîçäàåì ïîåäèíîê
|
||||||
|
$btl_id = 0;
|
||||||
|
$expB = 0;
|
||||||
|
$btl = ['players' => '', 'timeout' => 180, 'type' => 0, 'invis' => 0, 'noinc' => 0, 'travmChance' => 0, 'typeBattle' => 0, 'addExp' => $expB, 'money' => 0];
|
||||||
|
|
||||||
|
$ins = mysql_query(
|
||||||
|
'INSERT INTO `battle`
|
||||||
|
(`dungeon`,`dn_id`,`x`,`y`,`city`,`time_start`,`players`,`timeout`,`type`,`invis`,`noinc`,`travmChance`,`typeBattle`,`addExp`,`money`)
|
||||||
|
VALUES (
|
||||||
|
"' . $bot['dn_id'] . '",
|
||||||
|
"' . $bot['this_dn'] . '",
|
||||||
|
"' . $bot['x'] . '",
|
||||||
|
"' . $bot['y'] . '",
|
||||||
|
"' . $bot['userCity'] . '",
|
||||||
|
"' . time() . '",
|
||||||
|
"' . $btl['players'] . '",
|
||||||
|
"' . $btl['timeout'] . '",
|
||||||
|
"' . $btl['type'] . '",
|
||||||
|
"' . $btl['invis'] . '",
|
||||||
|
"' . $btl['noinc'] . '",
|
||||||
|
"' . $btl['travmChance'] . '",
|
||||||
|
"' . $btl['typeBattle'] . '",
|
||||||
|
"' . $btl['addExp'] . '",
|
||||||
|
"' . $btl['money'] . '"
|
||||||
|
)'
|
||||||
|
);
|
||||||
|
$btl_id = mysql_insert_id();
|
||||||
|
|
||||||
|
if ($btl_id > 0) { //Äîáàâëÿåì áîòîâ
|
||||||
|
$j = 0;
|
||||||
|
$logins_bot = [];
|
||||||
|
mysql_query(
|
||||||
|
'UPDATE `dungeon_bots` SET `inBattle` = "' . $btl_id . '" WHERE `id2` = "' . $bot['id2'] . '" LIMIT 1'
|
||||||
|
);
|
||||||
|
$jui = 1;
|
||||||
|
while ($jui <= $bot['colvo']) {
|
||||||
|
$k = botAddBattle($bot, $logins_bot);
|
||||||
|
$logins_bot = $k['logins_bot'];
|
||||||
|
if ($k != false) {
|
||||||
|
$upd = mysql_query(
|
||||||
|
'UPDATE `users` SET `battle` = "' . $btl_id . '" WHERE `id` = "' . $k['id'] . '" LIMIT 1'
|
||||||
|
);
|
||||||
|
if ($upd) {
|
||||||
|
$upd = mysql_query('UPDATE `stats` SET `team` = "2" WHERE `id` = "' . $k['id'] . '" LIMIT 1');
|
||||||
|
if ($upd) {
|
||||||
|
$j++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$jui++;
|
||||||
|
}
|
||||||
|
unset($logins_bot);
|
||||||
|
if ($j > 0) {
|
||||||
|
mysql_query(
|
||||||
|
'UPDATE `users` SET `battle` = "' . $btl_id . '" WHERE `id` = "' . $user['userId'] . '" LIMIT 1'
|
||||||
|
);
|
||||||
|
mysql_query('UPDATE `stats` SET `team` = "1" WHERE `id` = "' . $user['userId'] . '" LIMIT 1');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else { # Âìåøèâàåìñÿ â ïîåäèíîê.
|
||||||
|
$j = 0;
|
||||||
|
$logins_bot = [];
|
||||||
|
$logins_bot_text = [];
|
||||||
|
$logins_bot_vars = ['time1=' . time() . ''];
|
||||||
|
$logins_bot_inBattle = mysql_query(
|
||||||
|
'SELECT SUBSTRING_INDEX(`login`, " (", 1) as login2, count(`login`) as count, `login` FROM `battle_users` WHERE `battle` = "' . $battleID['id'] . '" AND `team`=2 GROUP BY `login2`'
|
||||||
|
);
|
||||||
|
while ($row = mysql_fetch_array($logins_bot_inBattle)) {
|
||||||
|
$logins_bot[$row['login2']] = (int)$row['count'];
|
||||||
|
}
|
||||||
|
mysql_query(
|
||||||
|
'UPDATE `dungeon_bots` SET `inBattle` = "' . $battleID['id'] . '" WHERE `id2` = "' . $bot['id2'] . '" LIMIT 1'
|
||||||
|
);
|
||||||
|
$jui = 1;
|
||||||
|
while ($jui <= $bot['colvo']) {
|
||||||
|
$k = botAddBattle($bot, $logins_bot);
|
||||||
|
$logins_bot = $k['logins_bot'];
|
||||||
|
|
||||||
|
$logins_bot_text[] = ' <strong>' . $k['login'] . '</strong>';
|
||||||
|
if ($k != false) {
|
||||||
|
$upd = mysql_query(
|
||||||
|
'UPDATE `users` SET `battle` = "' . $battleID['id'] . '" WHERE `id` = "' . $k['id'] . '" LIMIT 1'
|
||||||
|
);
|
||||||
|
if ($upd) {
|
||||||
|
$upd = mysql_query('UPDATE `stats` SET `team` = "2" WHERE `id` = "' . $k['id'] . '" LIMIT 1');
|
||||||
|
if ($upd) {
|
||||||
|
$j++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$jui++;
|
||||||
|
}
|
||||||
|
if ($j > 0) {
|
||||||
|
$logins_bot_text = '{tm1} Â ïîåäèíîê âìåøàëèñü: ' . implode(', ', $logins_bot_text) . '.';
|
||||||
|
$logins_bot_vars = implode('||', $logins_bot_vars);
|
||||||
|
$battle_log = mysql_fetch_array(
|
||||||
|
mysql_query(
|
||||||
|
'SELECT * FROM `battle_logs` WHERE `battle`=' . $battleID['id'] . ' ORDER BY `id_hod` DESC LIMIT 1'
|
||||||
|
)
|
||||||
|
);
|
||||||
|
if ($battle_log['id_hod'] > 0) {
|
||||||
|
mysql_query(
|
||||||
|
'INSERT INTO `battle_logs` (`time`,`battle`,`id_hod`,`text`,`vars`,`zona1`,`zonb1`,`zona2`,`zonb2`,`type`) VALUES ("' . time(
|
||||||
|
) . '","' . $battleID['id'] . '","' . ($battle_log['id_hod'] + 1) . '","' . $logins_bot_text . '","' . $logins_bot_vars . '","","","","",1)'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
unset($logins_bot);
|
||||||
|
if ($j > 0) {
|
||||||
|
mysql_query(
|
||||||
|
'UPDATE `users` SET `battle` = "' . $battleID['id'] . '" WHERE `id` = "' . $user['id'] . '" LIMIT 1'
|
||||||
|
);
|
||||||
|
mysql_query('UPDATE `stats` SET `team` = "1" WHERE `id` = "' . $user['id'] . '" LIMIT 1');
|
||||||
|
}
|
||||||
|
unset($logins_bot_inBattle);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# Ñîâåðøàåì íàïàäåíèå -> Äîáàâëÿåì Áîòîâ â ïîåäèíîê
|
||||||
|
function botAddBattle($bot, $logins_bot)
|
||||||
|
{
|
||||||
|
$add_bot = mysql_fetch_array(
|
||||||
|
mysql_query(
|
||||||
|
'SELECT
|
||||||
|
`id`, `login`, `stats`, `obraz`, `level`, `sex`, `name`, `deviz`, `hobby`, `type`, `itemsUse`, `priemUse`, `align`, `clan`, `align_zvanie`, `bonus`, `clan_zvanie`, `time_reg`, `city_reg`, `upLevel`, `active`, `expB`, `p_items`, `agressor`, `priems`, `priems_z`, `award`
|
||||||
|
FROM `test_bot`
|
||||||
|
WHERE `id` = "' . $bot['id_bot'] . '"
|
||||||
|
LIMIT 1'
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
if (isset($add_bot['id'])) {
|
||||||
|
if (isset($logins_bot[$add_bot['login']])) {
|
||||||
|
$logins_bot[$add_bot['login']]++;
|
||||||
|
$add_bot['login'] = $add_bot['login'] . ' (' . $logins_bot[$add_bot['login']] . ')';
|
||||||
|
} else {
|
||||||
|
$logins_bot[$add_bot['login']] = 1;
|
||||||
|
}
|
||||||
|
$ret = true;
|
||||||
|
if ($add_bot['time_reg'] == 100) {
|
||||||
|
$add_bot['time_reg'] = time();
|
||||||
|
}
|
||||||
|
if ($add_bot['city_reg'] == '{thiscity}') {
|
||||||
|
$add_bot['city_reg'] = $bot['userCity'];
|
||||||
|
}
|
||||||
|
$ins1 = mysql_query(
|
||||||
|
'INSERT INTO `users` (
|
||||||
|
`align`,
|
||||||
|
`login`,
|
||||||
|
`level`,
|
||||||
|
`pass`,
|
||||||
|
`city`,
|
||||||
|
`cityreg`,
|
||||||
|
`name`,
|
||||||
|
`sex`,
|
||||||
|
`deviz`,
|
||||||
|
`hobby`,
|
||||||
|
`timereg`,
|
||||||
|
`obraz`,
|
||||||
|
`bot_id`
|
||||||
|
) VALUES (
|
||||||
|
"' . $add_bot['align'] . '",
|
||||||
|
"' . $add_bot['login'] . '",
|
||||||
|
"' . $add_bot['level'] . '",
|
||||||
|
"' . md5('bot_pass_' . $add_bot['login'] . '_') . '",
|
||||||
|
"' . $bot['userCity'] . '",
|
||||||
|
"' . $add_bot['city_reg'] . '",
|
||||||
|
"' . $add_bot['name'] . '",
|
||||||
|
"' . $add_bot['sex'] . '",
|
||||||
|
"' . $add_bot['deviz'] . '",
|
||||||
|
"' . $add_bot['hobby'] . '",
|
||||||
|
"' . $add_bot['time_reg'] . '",
|
||||||
|
"' . $add_bot['obraz'] . '",
|
||||||
|
"' . $bot['id_bot'] . '"
|
||||||
|
)'
|
||||||
|
);
|
||||||
|
|
||||||
|
# Åñëè áîò óñïåøíî ñîçäàí.
|
||||||
|
if ($ins1) {
|
||||||
|
$uid = mysql_insert_id();
|
||||||
|
$ins2 = mysql_query(
|
||||||
|
'INSERT INTO `stats` (`id`,`stats`,`hpNow`,`upLevel`,`bot`) VALUES ("' . $uid . '","' . $add_bot['stats'] . '","1000000","' . $add_bot['upLevel'] . '","1")'
|
||||||
|
);
|
||||||
|
if ($ins2) {
|
||||||
|
$add_bot['id'] = $uid;
|
||||||
|
$add_bot['logins_bot'] = $logins_bot;
|
||||||
|
$ret = $add_bot;
|
||||||
|
|
||||||
|
//Âûäàåì ïðåäìåòû
|
||||||
|
//$this->addItem($item_id,$uid);
|
||||||
|
$iu = explode(',', $add_bot['itemsUse']);
|
||||||
|
$i = 0;
|
||||||
|
$w3b = 0;
|
||||||
|
while ($i < count($iu)) {
|
||||||
|
if ($iu[$i] > 0) {
|
||||||
|
$idiu = botAddItem($iu[$i], $add_bot['id'], $bot['userCity']);
|
||||||
|
$islot = mysql_fetch_array(
|
||||||
|
mysql_query('SELECT `id`,`inslot` FROM `items_main` WHERE `id` = "' . $iu[$i] . '" LIMIT 1')
|
||||||
|
);
|
||||||
|
if (isset($islot['id'])) {
|
||||||
|
if ($islot['inslot'] == 3) {
|
||||||
|
if ($w3b == 1) {
|
||||||
|
$islot = 14;
|
||||||
|
} else {
|
||||||
|
$islot = 3;
|
||||||
|
$w3b = 1;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$islot = $islot['inslot'];
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$islot = 2000;
|
||||||
|
}
|
||||||
|
if (isset($idiu, $islot)) {
|
||||||
|
mysql_query(
|
||||||
|
'UPDATE `items_users` SET `inOdet` = "' . $islot . '" WHERE `id` = "' . $idiu . '" LIMIT 1'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
$ret = false;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$ret = false;
|
||||||
|
}
|
||||||
|
return $ret;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#Âûäàåì ïðåäìåòû Áîòó.
|
||||||
|
function botAddItem($item_id, $bot_uid, $city)
|
||||||
|
{
|
||||||
|
$i = mysql_fetch_array(
|
||||||
|
mysql_query(
|
||||||
|
'SELECT `im`.`id`,`im`.`name`,`im`.`img`,`im`.`type`,`im`.`inslot`,`im`.`2h`,`im`.`2too`,`im`.`iznosMAXi`,`im`.`inRazdel`,`im`.`price1`,`im`.`price2`,`im`.`pricerep`,`im`.`magic_chance`,`im`.`info`,`im`.`massa`,`im`.`level`,`im`.`magic_inci`,`im`.`overTypei`,`im`.`group`,`im`.`group_max`,`im`.`geni`,`im`.`ts`,`im`.`srok`,`im`.`class`,`im`.`class_point`,`im`.`anti_class`,`im`.`anti_class_point`,`im`.`max_text`,`im`.`useInBattle`,`im`.`lbtl`,`im`.`lvl_itm`,`im`.`lvl_exp`,`im`.`lvl_aexp` FROM `items_main` AS `im` WHERE `im`.`id` = "' . mysql_real_escape_string(
|
||||||
|
$item_id
|
||||||
|
) . '" LIMIT 1'
|
||||||
|
)
|
||||||
|
);
|
||||||
|
if (isset($i['id'])) {
|
||||||
|
$d = mysql_fetch_array(
|
||||||
|
mysql_query(
|
||||||
|
'SELECT `id`,`items_id`,`data` FROM `items_main_data` WHERE `items_id` = "' . $i['id'] . '" LIMIT 1'
|
||||||
|
)
|
||||||
|
);
|
||||||
|
//íîâàÿ äàòà
|
||||||
|
$data = $d['data'];
|
||||||
|
$ins = mysql_query(
|
||||||
|
'
|
||||||
|
INSERT INTO `items_users` (
|
||||||
|
`overType`,`item_id`,`uid`,`data`,`iznosMAX`,`geniration`,`magic_inc`,`maidin`,`lastUPD`,`time_create`,`dn_delete`
|
||||||
|
) VALUES (
|
||||||
|
"' . $i['overTypei'] . '",
|
||||||
|
"' . $i['id'] . '",
|
||||||
|
"' . $bot_uid . '",
|
||||||
|
"' . $data . '",
|
||||||
|
"' . $i['iznosMAXi'] . '",
|
||||||
|
"' . $i['geni'] . '",
|
||||||
|
"' . $i['magic_inci'] . '",
|
||||||
|
"' . $city . '",
|
||||||
|
"' . time() . '",
|
||||||
|
"' . time() . '",
|
||||||
|
"' . $i['dn_delete'] . '"
|
||||||
|
)'
|
||||||
|
);
|
||||||
|
|
||||||
|
# Åñëè ïðåäìåò óñïåøíî äîáàâëåí â áàçó äàííûõ.
|
||||||
|
if ($ins) {
|
||||||
|
$rt = mysql_insert_id();
|
||||||
|
# îòêëþ÷åíà çàïèñü ïîëó÷åíèÿ ïðåäìåòà â Äåëî.
|
||||||
|
} else {
|
||||||
|
$rt = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $rt;
|
||||||
|
}
|
||||||
|
|
||||||
|
function moveBots($direction, $b)
|
||||||
|
{
|
||||||
|
$toGoX = 0;
|
||||||
|
$toGoY = 0;
|
||||||
|
|
||||||
|
if (isset($b['noBot']) && $b['noBot'] != '0000') {
|
||||||
|
if ($b['noBot'][0] != '0') {
|
||||||
|
$b['goTop'] = 0;
|
||||||
|
}
|
||||||
|
if ($b['noBot'][1] != '0') {
|
||||||
|
$b['goLeft'] = 0;
|
||||||
|
}
|
||||||
|
if ($b['noBot'][2] != '0') {
|
||||||
|
$b['goBottom'] = 0;
|
||||||
|
}
|
||||||
|
if ($b['noBot'][3] != '0') {
|
||||||
|
$b['goRight'] = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$go = [
|
||||||
|
1 => ['d' => (int)$b['goTop'], 'go1' => (int)$b['goLeft'], 'go2' => (int)$b['goRight'], 'x' => (int)$b['x'], 'y' => (int)$b['y'], 's' => (int)$b['s']],
|
||||||
|
2 => ['d' => (int)$b['goLeft'], 'go1' => (int)$b['goBottom'], 'go2' => (int)$b['goTop'], 'x' => (int)$b['x'], 'y' => (int)$b['y'], 's' => (int)$b['s']],
|
||||||
|
3 => ['d' => (int)$b['goBottom'], 'go1' => (int)$b['goRight'], 'go2' => (int)$b['goLeft'], 'x' => (int)$b['x'], 'y' => (int)$b['y'], 's' => (int)$b['s']],
|
||||||
|
4 => ['d' => (int)$b['goRight'], 'go1' => (int)$b['goTop'], 'go2' => (int)$b['goBottom'], 'x' => (int)$b['x'], 'y' => (int)$b['y'], 's' => (int)$b['s']],
|
||||||
|
];
|
||||||
|
$dir = [
|
||||||
|
1 => ['moveForward' => ['x' => '0', 'y' => '1'], 'moveBack' => ['x' => '0', 'y' => '-1'], 'moveGo1' => ['x' => '-1', 'y' => '0'], 'moveGo2' => ['x' => '1', 'y' => '0']],
|
||||||
|
2 => ['moveForward' => ['x' => '-1', 'y' => '0'], 'moveBack' => ['x' => '1', 'y' => '0'], 'moveGo1' => ['x' => '0', 'y' => '-1'], 'moveGo2' => ['x' => '0', 'y' => '1']],
|
||||||
|
3 => ['moveForward' => ['x' => '0', 'y' => '-1'], 'moveBack' => ['x' => '0', 'y' => '1'], 'moveGo1' => ['x' => '1', 'y' => '0'], 'moveGo2' => ['x' => '-1', 'y' => '0']],
|
||||||
|
4 => ['moveForward' => ['x' => '1', 'y' => '0'], 'moveBack' => ['x' => '-1', 'y' => '0'], 'moveGo1' => ['x' => '0', 'y' => '1'], 'moveGo2' => ['x' => '0', 'y' => '-1']],
|
||||||
|
];
|
||||||
|
$go = $go[$direction];
|
||||||
|
$dir = $dir[$direction];
|
||||||
|
if ($go['d'] == 1) {
|
||||||
|
$toGoY = $dir['moveForward']['y'];
|
||||||
|
$toGoX = $dir['moveForward']['x'];
|
||||||
|
if (rand(1, 100) > 66) {
|
||||||
|
if ($go['go1'] == 1 && $go['go2'] == 0) {
|
||||||
|
$toGoY = $dir['moveGo1']['y'];
|
||||||
|
$toGoX = $dir['moveGo1']['x'];
|
||||||
|
} elseif ($go['go1'] == 0 && $go['go2'] == 1) {
|
||||||
|
$toGoY = $dir['moveGo2']['y'];
|
||||||
|
$toGoX = $dir['moveGo2']['x'];
|
||||||
|
} elseif ($go['go1'] == 1 && $go['go2'] == 1) {
|
||||||
|
$a = rand(1, 2);
|
||||||
|
$toGoY = $dir['moveGo' . $a]['y'];
|
||||||
|
$toGoX = $dir['moveGo' . $a]['x'];
|
||||||
|
}
|
||||||
|
} elseif (rand(1, 100) > 96) {
|
||||||
|
$toGoY = $dir['moveBack']['y'];
|
||||||
|
$toGoX = $dir['moveBack']['x'];
|
||||||
|
}
|
||||||
|
} elseif ($go['d'] == 0) {
|
||||||
|
if ($go['go1'] == 1 && $go['go2'] == 1) {
|
||||||
|
if (rand(0, 1) == 1) {
|
||||||
|
$toGoY = $dir['moveGo1']['y'];
|
||||||
|
$toGoX = $dir['moveGo1']['x'];
|
||||||
|
} else {
|
||||||
|
$toGoY = $dir['moveGo2']['y'];
|
||||||
|
$toGoX = $dir['moveGo2']['x'];
|
||||||
|
}
|
||||||
|
} elseif ($go['go1'] == 1 && $go['go2'] == 0) {
|
||||||
|
$toGoY = $dir['moveGo1']['y'];
|
||||||
|
$toGoX = $dir['moveGo1']['x'];
|
||||||
|
} elseif ($go['go1'] == 0 && $go['go2'] == 1) {
|
||||||
|
$toGoY = $dir['moveGo2']['y'];
|
||||||
|
$toGoX = $dir['moveGo2']['x'];
|
||||||
|
} elseif ($go['go1'] == 0 && $go['go2'] == 0) {
|
||||||
|
$toGoY = $dir['moveBack']['y'];
|
||||||
|
$toGoX = $dir['moveBack']['x'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
unset($dir, $go, $direction, $a);
|
||||||
|
return ['x' => (int)$toGoX, 'y' => (int)$toGoY];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# çàïóñê ñêðèïòà.
|
||||||
|
function start()
|
||||||
|
{
|
||||||
|
# Ñòðàíèöà ñîçäàíà 0.0000
|
||||||
|
$mtime = microtime();
|
||||||
|
$mtime = explode(" ", $mtime);
|
||||||
|
$tstart = $mtime[1] + $mtime[0];
|
||||||
|
|
||||||
|
# Âûáèðàåì âñåõ áîòîâ.
|
||||||
|
#  âûáîðêó âêëþ÷åíî: Ïîçèöèÿ áîòà, Íàïðàâëåíèå êóäà îí ìîæåò èäòè, Ñóùåñòâóåò ëè ðÿäîì Èãðîê, åãî êîîðäèíàòû è â ïîåäèíêå ëè îí.
|
||||||
|
$query = mysql_query(
|
||||||
|
"SELECT
|
||||||
|
`dn`.`id` as `this_dn`, `dn`.`id2` as `dn_id`, `db`.`id2`, `db`.`id_bot`, `tb`.`login` as login, `db`.`colvo`, `db`.`go_bot`, `db`.`x`, `db`.`y`, `db`.`s`, `db`.`atack`, `tb`.`agressor`,
|
||||||
|
`dm`.`go_1` as `goRight`, `dm`.`go_2` as `goLeft`, `dm`.`go_3` as `goTop`, `dm`.`go_4` as `goBottom`, `dm`.`no_bot` as `noBot`,
|
||||||
|
`user_info`.`id` as `userId`,
|
||||||
|
`user_info`.`login` as `userLogin`,
|
||||||
|
`user_stats`.`hpNow` as `userHP`,
|
||||||
|
`user_stats`.`x` as `userPosX`,
|
||||||
|
`user_stats`.`y` as `userPosY`,
|
||||||
|
`user_info`.`battle` as `userBattle`
|
||||||
|
FROM `dungeon_now` as `dn`
|
||||||
|
LEFT JOIN `dungeon_bots` as `db` ON `db`.`dn` = `dn`.`id`
|
||||||
|
LEFT JOIN `dungeon_map` as `dm` ON ( `dm`.`x` = `db`.`x` AND `dm`.`y` = `db`.`y` AND `dm`.`id_dng` = `dn`.`id2` )
|
||||||
|
LEFT JOIN `test_bot` AS `tb` ON `db`.`id_bot` = `tb`.`id`
|
||||||
|
LEFT JOIN `stats` AS `user_stats` ON ( ( `user_stats`.`x`+1 >= `db`.`x` AND `user_stats`.`x`-1 <= `db`.`x` ) AND ( `user_stats`.`y`+1 >= `db`.`y` AND `user_stats`.`y`-1 <= `db`.`y`) AND `user_stats`.`dnow` = `dn`.`id` )
|
||||||
|
LEFT JOIN `users` AS `user_info` ON ( `user_stats`.`id` = `user_info`.`id` )
|
||||||
|
|
||||||
|
WHERE
|
||||||
|
`dn`.`time_finish` = '0' AND
|
||||||
|
`db`.`atack` = '0' AND
|
||||||
|
`db`.`delete` = '0' AND
|
||||||
|
`db`.`for_dn` = '0' AND
|
||||||
|
( ( `db`.`go_bot` > '" . (time() - 32400) . "' AND `db`.`go_bot` < '" . (time()) . "') OR `db`.`go_bot`='1') AND
|
||||||
|
`db`.`inBattle`='0'
|
||||||
|
GROUP BY `db`.`id2`
|
||||||
|
ORDER BY `db`.`go_bot` ASC"
|
||||||
|
);
|
||||||
|
|
||||||
|
while ($bot = mysql_fetch_array($query)) {
|
||||||
|
if ($bot['go_bot'] > 0 && $bot['go_bot'] <= time()) {
|
||||||
|
$sNext = true;
|
||||||
|
$sTo = $bot['s'];
|
||||||
|
$xFrom = $bot['x']; # òåêóùèå êîîðäèíàòû X
|
||||||
|
$yFrom = $bot['y']; # òåêóùèå êîîðäèíàòû Y
|
||||||
|
|
||||||
|
$return = moveBots($bot['s'], $bot);
|
||||||
|
$xTo = $bot['x'] + $return['x'];
|
||||||
|
$yTo = $bot['y'] + $return['y'];
|
||||||
|
# Ïðîâåðÿåì, èìååòñÿ ëè ïåðåõîä ïî êëåòêå.
|
||||||
|
$inSight = 0;
|
||||||
|
if (isset($bot['id2'])) {
|
||||||
|
if ($xFrom == $xTo && $yFrom == $yTo) { # Åñëè îñòàåìñÿ íà ìåñòå.
|
||||||
|
$inSight = 1;
|
||||||
|
} elseif (isset($bot['goRight']) && $xFrom == $xTo - 1 && $bot['goRight'] == 1) { //ïðàâî
|
||||||
|
$sTo = 4;
|
||||||
|
$inSight = 1;
|
||||||
|
} elseif (isset($bot['goLeft']) && $xFrom == $xTo + 1 && $bot['goLeft'] == 1) { //ëåâî
|
||||||
|
$sTo = 2;
|
||||||
|
$inSight = 1;
|
||||||
|
} elseif (isset($bot['goTop']) && $yFrom == $yTo - 1 && $bot['goTop'] == 1) { //âåðõ
|
||||||
|
$sTo = 1;
|
||||||
|
$inSight = 1;
|
||||||
|
} elseif (isset($bot['goBottom']) && $yFrom == $yTo + 1 && $bot['goBottom'] == 1) { //íèç
|
||||||
|
$sTo = 3;
|
||||||
|
$inSight = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($bot['userId'], $bot['userPosY'], $bot['userPosX']) && $bot['userId'] != '' && $bot['agressor'] == 1 && (
|
||||||
|
($bot['userPosY'] == $bot['y'] + 1 && $bot['userPosX'] == $bot['x']) or
|
||||||
|
($bot['userPosY'] == $bot['y'] - 1 && $bot['userPosX'] == $bot['x']) or
|
||||||
|
($bot['userPosY'] == $bot['y'] && $bot['userPosX'] == $bot['x'] - 1) or
|
||||||
|
($bot['userPosY'] == $bot['y'] && $bot['userPosX'] == $bot['x'] + 1)
|
||||||
|
)) {
|
||||||
|
bot['userPosY'] = $yFrom;
|
||||||
|
$bot['userPosX'] = $xFrom;
|
||||||
|
mysql_query(
|
||||||
|
'UPDATE `stats` SET `x` = "' . $xFrom . '" , `y` = "' . $yFrom . '" WHERE `id` = "' . $bot['userId'] . '" LIMIT 1'
|
||||||
|
);
|
||||||
|
botAttack($bot, $bot);
|
||||||
|
} elseif (isset($bot['userId'], $bot['userPosY'], $bot['userPosX']) && $bot['userId'] != '' && $inSight == 1 && $yTo == $bot['userPosY'] && $xTo == $bot['userPosX'] && $bot['atack'] == 1) {
|
||||||
|
botAttack($bot, $bot);
|
||||||
|
} elseif ($inSight == 1) { // Ïåðåäâèæåíèå áîòîâ.
|
||||||
|
$bot['go_bot'] = time() + rand(7, 15);
|
||||||
|
mysql_query(
|
||||||
|
'UPDATE `dungeon_bots` SET `x` = "' . $xTo . '",`y` = "' . $yTo . '", `s` = "' . $sTo . '", `go_bot` = "' . $bot['go_bot'] . '" WHERE `id2` = "' . $bot['id2'] . '" LIMIT 1 '
|
||||||
|
);
|
||||||
|
}
|
||||||
|
unset($xFrom, $yFrom, $xTo, $yTo, $inSight, $sNext, $sTo);
|
||||||
|
}
|
||||||
|
unset($bot);
|
||||||
|
}
|
||||||
|
unset($query, $bot);
|
||||||
|
|
||||||
|
$mtime = microtime();
|
||||||
|
$mtime = explode(" ", $mtime);
|
||||||
|
$mtime = $mtime[1] + $mtime[0];
|
||||||
|
$totaltime = ($mtime - $tstart);
|
||||||
|
printf("Ñòðàíèöà ñãåíåðèðîâàíà çà %f ñåêóíä !", $totaltime);
|
||||||
|
}
|
||||||
|
|
||||||
|
# Çàïóñêàåì âûïîëíåíèå ïðîöåññà.
|
||||||
|
start();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* Äëÿ îïòèìèçàöèè çàïðîñà îáíîâëåíèé ïîçèöèé
|
||||||
|
|
||||||
|
UPDATE dungeon_bots SET
|
||||||
|
x = CASE
|
||||||
|
WHEN id2 = '.$bot['id2'].' THEN "test2"
|
||||||
|
WHEN id2 = '.$bot['id2'].' THEN "test1" END
|
||||||
|
WHERE id2 IN ('.$bot['id2'].', 2, 3, 4)
|
||||||
|
|
||||||
|
*/
|
@ -1,14 +1,14 @@
|
|||||||
<?php
|
<?php
|
||||||
const GAME = true;
|
|
||||||
setlocale(LC_CTYPE, "ru_RU.CP1251");
|
|
||||||
include('_incl_data/__config.php');
|
|
||||||
include('_incl_data/class/__db_connect.php');
|
|
||||||
|
|
||||||
if (!isset($_GET['test']) && UserIp::get() != $_SERVER['SERVER_ADDR'] && UserIp::get() != '127.0.0.1' && UserIp::get(
|
/**
|
||||||
) != '' && UserIp::get() != '31.131.106.205') {
|
* Áàøíÿ ñìåðòè?
|
||||||
exit(UserIp::get() . '<br>' . $_SERVER['SERVER_ADDR']);
|
*
|
||||||
}
|
* Âûçîâ ðàç â ìèíóòó.
|
||||||
|
*/
|
||||||
|
|
||||||
|
require_once dirname(__DIR__) . DIRECTORY_SEPARATOR . 'autoload.php';
|
||||||
|
|
||||||
|
//todo: IN PROGRESS
|
||||||
function changeSleep($uid, $sleep_action)
|
function changeSleep($uid, $sleep_action)
|
||||||
{
|
{
|
||||||
$u = User::start();
|
$u = User::start();
|
@ -57,6 +57,7 @@ if (!extension_loaded('mysql') && !function_exists('mysql_connect')) {
|
|||||||
* @param $username
|
* @param $username
|
||||||
* @param $password
|
* @param $password
|
||||||
* @return mysqli|null
|
* @return mysqli|null
|
||||||
|
* @deprecated
|
||||||
*/
|
*/
|
||||||
function mysql_connect($server, $username, $password, $new_link = false, $client_flags = 0)
|
function mysql_connect($server, $username, $password, $new_link = false, $client_flags = 0)
|
||||||
{
|
{
|
||||||
@ -73,6 +74,7 @@ if (!extension_loaded('mysql') && !function_exists('mysql_connect')) {
|
|||||||
* @param $username
|
* @param $username
|
||||||
* @param $password
|
* @param $password
|
||||||
* @return mysqli|null
|
* @return mysqli|null
|
||||||
|
* @deprecated
|
||||||
*/
|
*/
|
||||||
function mysql_pconnect($server, $username, $password, $new_link = false, $client_flags = 0)
|
function mysql_pconnect($server, $username, $password, $new_link = false, $client_flags = 0)
|
||||||
{
|
{
|
||||||
@ -85,6 +87,7 @@ if (!extension_loaded('mysql') && !function_exists('mysql_connect')) {
|
|||||||
/**
|
/**
|
||||||
* @param $databaseName
|
* @param $databaseName
|
||||||
* @return bool
|
* @return bool
|
||||||
|
* @deprecated
|
||||||
*/
|
*/
|
||||||
function mysql_select_db($databaseName)
|
function mysql_select_db($databaseName)
|
||||||
{
|
{
|
||||||
@ -97,6 +100,7 @@ if (!extension_loaded('mysql') && !function_exists('mysql_connect')) {
|
|||||||
* @param $query
|
* @param $query
|
||||||
* @param mysqli $mysqli
|
* @param mysqli $mysqli
|
||||||
* @return bool|mysqli_result
|
* @return bool|mysqli_result
|
||||||
|
* @deprecated
|
||||||
*/
|
*/
|
||||||
function mysql_query($query, mysqli $mysqli = null)
|
function mysql_query($query, mysqli $mysqli = null)
|
||||||
{
|
{
|
||||||
@ -107,6 +111,7 @@ if (!extension_loaded('mysql') && !function_exists('mysql_connect')) {
|
|||||||
* @param $string
|
* @param $string
|
||||||
* @param mysqli $mysqli
|
* @param mysqli $mysqli
|
||||||
* @return string
|
* @return string
|
||||||
|
* @deprecated
|
||||||
*/
|
*/
|
||||||
function mysql_real_escape_string($string, mysqli $mysqli = null)
|
function mysql_real_escape_string($string, mysqli $mysqli = null)
|
||||||
{
|
{
|
||||||
@ -116,6 +121,7 @@ if (!extension_loaded('mysql') && !function_exists('mysql_connect')) {
|
|||||||
/**
|
/**
|
||||||
* @param mysqli_result $result
|
* @param mysqli_result $result
|
||||||
* @return bool|array
|
* @return bool|array
|
||||||
|
* @deprecated
|
||||||
*/
|
*/
|
||||||
function mysql_fetch_assoc(mysqli_result $result)
|
function mysql_fetch_assoc(mysqli_result $result)
|
||||||
{
|
{
|
||||||
@ -144,6 +150,7 @@ if (!extension_loaded('mysql') && !function_exists('mysql_connect')) {
|
|||||||
/**
|
/**
|
||||||
* @param mysqli_result $result
|
* @param mysqli_result $result
|
||||||
* @return bool|int
|
* @return bool|int
|
||||||
|
* @deprecated
|
||||||
*/
|
*/
|
||||||
function mysql_num_rows(mysqli_result $result)
|
function mysql_num_rows(mysqli_result $result)
|
||||||
{
|
{
|
||||||
@ -172,6 +179,7 @@ if (!extension_loaded('mysql') && !function_exists('mysql_connect')) {
|
|||||||
/**
|
/**
|
||||||
* @param mysqli $mysqli
|
* @param mysqli $mysqli
|
||||||
* @return int
|
* @return int
|
||||||
|
* @deprecated
|
||||||
*/
|
*/
|
||||||
function mysql_affected_rows(mysqli $mysqli = null)
|
function mysql_affected_rows(mysqli $mysqli = null)
|
||||||
{
|
{
|
||||||
@ -189,6 +197,7 @@ if (!extension_loaded('mysql') && !function_exists('mysql_connect')) {
|
|||||||
/**
|
/**
|
||||||
* @param mysqli $mysqli
|
* @param mysqli $mysqli
|
||||||
* @return bool
|
* @return bool
|
||||||
|
* @deprecated
|
||||||
*/
|
*/
|
||||||
function mysql_close(mysqli $mysqli = null)
|
function mysql_close(mysqli $mysqli = null)
|
||||||
{
|
{
|
||||||
@ -207,6 +216,7 @@ if (!extension_loaded('mysql') && !function_exists('mysql_connect')) {
|
|||||||
/**
|
/**
|
||||||
* @param mysqli $mysqli
|
* @param mysqli $mysqli
|
||||||
* @return int
|
* @return int
|
||||||
|
* @deprecated
|
||||||
*/
|
*/
|
||||||
function mysql_errno(mysqli $mysqli = null)
|
function mysql_errno(mysqli $mysqli = null)
|
||||||
{
|
{
|
||||||
@ -229,6 +239,7 @@ if (!extension_loaded('mysql') && !function_exists('mysql_connect')) {
|
|||||||
/**
|
/**
|
||||||
* @param mysqli $mysqli
|
* @param mysqli $mysqli
|
||||||
* @return string
|
* @return string
|
||||||
|
* @deprecated
|
||||||
*/
|
*/
|
||||||
function mysql_error(mysqli $mysqli = null)
|
function mysql_error(mysqli $mysqli = null)
|
||||||
{
|
{
|
||||||
@ -239,6 +250,7 @@ if (!extension_loaded('mysql') && !function_exists('mysql_connect')) {
|
|||||||
* @param mysqli_result $result
|
* @param mysqli_result $result
|
||||||
* @param $result_type
|
* @param $result_type
|
||||||
* @return void
|
* @return void
|
||||||
|
* @deprecated
|
||||||
*/
|
*/
|
||||||
function mysql_fetch_array(mysqli_result $result, $result_type = MYSQL_BOTH)
|
function mysql_fetch_array(mysqli_result $result, $result_type = MYSQL_BOTH)
|
||||||
{
|
{
|
||||||
@ -257,6 +269,7 @@ if (!extension_loaded('mysql') && !function_exists('mysql_connect')) {
|
|||||||
/**
|
/**
|
||||||
* @param $query
|
* @param $query
|
||||||
* @param mysqli $mysqli
|
* @param mysqli $mysqli
|
||||||
|
* @deprecated
|
||||||
*/
|
*/
|
||||||
function mysql_unbuffered_query($query, mysqli $mysqli = null)
|
function mysql_unbuffered_query($query, mysqli $mysqli = null)
|
||||||
{
|
{
|
||||||
@ -265,6 +278,7 @@ if (!extension_loaded('mysql') && !function_exists('mysql_connect')) {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @return string
|
* @return string
|
||||||
|
* @deprecated
|
||||||
*/
|
*/
|
||||||
function mysql_get_client_info()
|
function mysql_get_client_info()
|
||||||
{
|
{
|
||||||
@ -274,6 +288,7 @@ if (!extension_loaded('mysql') && !function_exists('mysql_connect')) {
|
|||||||
/**
|
/**
|
||||||
* @param mysqli_result $result
|
* @param mysqli_result $result
|
||||||
* @return void
|
* @return void
|
||||||
|
* @deprecated
|
||||||
*/
|
*/
|
||||||
function mysql_free_result(mysqli_result $result)
|
function mysql_free_result(mysqli_result $result)
|
||||||
{
|
{
|
||||||
@ -379,6 +394,7 @@ if (!extension_loaded('mysql') && !function_exists('mysql_connect')) {
|
|||||||
*
|
*
|
||||||
* @param null $mysqli
|
* @param null $mysqli
|
||||||
* @return bool|string
|
* @return bool|string
|
||||||
|
* @deprecated
|
||||||
*/
|
*/
|
||||||
function mysql_get_proto_info(mysqli $mysqli = null)
|
function mysql_get_proto_info(mysqli $mysqli = null)
|
||||||
{
|
{
|
||||||
@ -414,6 +430,7 @@ if (!extension_loaded('mysql') && !function_exists('mysql_connect')) {
|
|||||||
*
|
*
|
||||||
* @param null $mysqli
|
* @param null $mysqli
|
||||||
* @return int|string
|
* @return int|string
|
||||||
|
* @deprecated
|
||||||
*/
|
*/
|
||||||
function mysql_insert_id(mysqli $mysqli = null)
|
function mysql_insert_id(mysqli $mysqli = null)
|
||||||
{
|
{
|
||||||
@ -427,6 +444,7 @@ if (!extension_loaded('mysql') && !function_exists('mysql_connect')) {
|
|||||||
* @param $row
|
* @param $row
|
||||||
* @param int $field
|
* @param int $field
|
||||||
* @return mixed
|
* @return mixed
|
||||||
|
* @deprecated
|
||||||
*/
|
*/
|
||||||
function mysql_result($result, $row, $field = 0)
|
function mysql_result($result, $row, $field = 0)
|
||||||
{
|
{
|
||||||
@ -444,6 +462,7 @@ if (!extension_loaded('mysql') && !function_exists('mysql_connect')) {
|
|||||||
*
|
*
|
||||||
* @param mysqli_result $result
|
* @param mysqli_result $result
|
||||||
* @return int
|
* @return int
|
||||||
|
* @deprecated
|
||||||
*/
|
*/
|
||||||
function mysql_num_fields(mysqli_result $result)
|
function mysql_num_fields(mysqli_result $result)
|
||||||
{
|
{
|
||||||
@ -472,6 +491,7 @@ if (!extension_loaded('mysql') && !function_exists('mysql_connect')) {
|
|||||||
* @param mysqli_result $result
|
* @param mysqli_result $result
|
||||||
* @param int $field_offset
|
* @param int $field_offset
|
||||||
* @return bool|object
|
* @return bool|object
|
||||||
|
* @deprecated
|
||||||
*/
|
*/
|
||||||
function mysql_fetch_field(mysqli_result $result, $field_offset = 0)
|
function mysql_fetch_field(mysqli_result $result, $field_offset = 0)
|
||||||
{
|
{
|
||||||
@ -488,6 +508,7 @@ if (!extension_loaded('mysql') && !function_exists('mysql_connect')) {
|
|||||||
* @param mysqli_result $result
|
* @param mysqli_result $result
|
||||||
* @param int $field_offset
|
* @param int $field_offset
|
||||||
* @return bool
|
* @return bool
|
||||||
|
* @deprecated
|
||||||
*/
|
*/
|
||||||
function mysql_field_len(mysqli_result $result, $field_offset = 0)
|
function mysql_field_len(mysqli_result $result, $field_offset = 0)
|
||||||
{
|
{
|
||||||
|
@ -238,11 +238,11 @@ if (!isset($_GET['look'])) {
|
|||||||
<meta http-equiv="Content-Type" content="text/html; charset=windows-1251"/>
|
<meta http-equiv="Content-Type" content="text/html; charset=windows-1251"/>
|
||||||
<title>Âèçóàëüíûé ðåäàêòîð Ëàáèðèíòîâ © new-combats.com</title>
|
<title>Âèçóàëüíûé ðåäàêòîð Ëàáèðèíòîâ © new-combats.com</title>
|
||||||
|
|
||||||
<script type="text/javascript" src="js/jquery.js"></script>
|
<script type="text/javascript" src="../js/jquery.js"></script>
|
||||||
<script type="text/javascript" src="js/jqueryrotate.js"></script>
|
<script type="text/javascript" src="../js/jqueryrotate.js"></script>
|
||||||
<script type="text/javascript" src="js/jquery.zclip.js"></script>
|
<script type="text/javascript" src="../js/jquery.zclip.js"></script>
|
||||||
<script type="text/javascript" src="js/jquery.cookie.js"></script>
|
<script type="text/javascript" src="../js/jquery.cookie.js"></script>
|
||||||
<script type="text/javascript" src="js/title.js"></script>
|
<script type="text/javascript" src="../js/title.js"></script>
|
||||||
|
|
||||||
<link href="https://img.new-combats.com/css/dungeon_<?php echo $d->point['css']; ?>.css" rel="stylesheet"
|
<link href="https://img.new-combats.com/css/dungeon_<?php echo $d->point['css']; ?>.css" rel="stylesheet"
|
||||||
type="text/css">
|
type="text/css">
|
||||||
@ -534,10 +534,10 @@ if (!isset($_GET['look'])) {
|
|||||||
d.innerHTML = '';
|
d.innerHTML = '';
|
||||||
var t = '';
|
var t = '';
|
||||||
if (talk > 0) {
|
if (talk > 0) {
|
||||||
t += '<a href="main.php?talk=' + talk + '&rnd=0.28626200682069150">Äèàëîã</a><br>';
|
t += '<a href=' + talk + '"../main.php?talk=&rnd=0.28626200682069150">Äèàëîã</a><br>';
|
||||||
}
|
}
|
||||||
if (atk == 1) {
|
if (atk == 1) {
|
||||||
t += '<a href="main.php?atack=' + id + '&rnd=0.28626200682069150">Íàïàñòü</a><br>';
|
t += '<a href=' + id + '"../main.php?atack=&rnd=0.28626200682069150">Íàïàñòü</a><br>';
|
||||||
}
|
}
|
||||||
if (look == 1) {
|
if (look == 1) {
|
||||||
t += 'Ïðîñìîòð<br>';
|
t += 'Ïðîñìîòð<br>';
|
@ -28,7 +28,7 @@ $r = round((int)$_GET['r']);
|
|||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
<form method="post" action="/editor_shop.php?sid=<?= $sid . '&r=' . $r ?>">
|
<form method="post" action="/adminion/editor_shop.php?sid=<?= $sid . '&r=' . $r ?>">
|
||||||
<table width="1000" border="0" align="center" cellpadding="10" cellspacing="0">
|
<table width="1000" border="0" align="center" cellpadding="10" cellspacing="0">
|
||||||
<tr>
|
<tr>
|
||||||
<td align="center"><p>Ìàãàçèí:
|
<td align="center"><p>Ìàãàçèí:
|
||||||
@ -73,7 +73,7 @@ $r = round((int)$_GET['r']);
|
|||||||
?>
|
?>
|
||||||
</select>
|
</select>
|
||||||
</p>
|
</p>
|
||||||
<p><a href="/editor_shop.php?sid=<?= $sid ?>&r=<?= $r ?>">ÎÁÍÎÂÈÒÜ ÑÒÐÀÍÈÖÓ</a><br>
|
<p><a href="/adminion/editor_shop.php?sid=<?= $sid ?>&r=<?= $r ?>">ÎÁÍÎÂÈÒÜ ÑÒÐÀÍÈÖÓ</a><br>
|
||||||
<br>
|
<br>
|
||||||
</p>
|
</p>
|
||||||
<hr>
|
<hr>
|
@ -28,7 +28,7 @@ function MM_jumpMenu(targ,selObj,restore){ //v3.0
|
|||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
<form method="post" action="/shop_editor.php?sid=<?=$sid.'&r='.$r?>">
|
<form method="post" action="/adminion/shop_editor.php?sid=<?=$sid.'&r='.$r?>">
|
||||||
<table width="1000" border="0" align="center" cellpadding="10" cellspacing="0">
|
<table width="1000" border="0" align="center" cellpadding="10" cellspacing="0">
|
||||||
<tr>
|
<tr>
|
||||||
<td align="center"><p>ìàãàçèí:
|
<td align="center"><p>ìàãàçèí:
|
||||||
@ -67,7 +67,7 @@ function MM_jumpMenu(targ,selObj,restore){ //v3.0
|
|||||||
?>
|
?>
|
||||||
</select>
|
</select>
|
||||||
</p>
|
</p>
|
||||||
<p><a href="/shop_editor.php?sid=<?=$sid?>&r=<?=$r?>">ÎÁÍÎÂÈÒÜ ÑÒÐÀÍÈÖÓ</a><br>
|
<p><a href="/adminion/shop_editor.php?sid=<?=$sid?>&r=<?=$r?>">ÎÁÍÎÂÈÒÜ ÑÒÐÀÍÈÖÓ</a><br>
|
||||||
<br>
|
<br>
|
||||||
</p>
|
</p>
|
||||||
<hr>
|
<hr>
|
11786
bak/Battle.php
11786
bak/Battle.php
File diff suppressed because it is too large
Load Diff
@ -1,142 +0,0 @@
|
|||||||
<?php
|
|
||||||
/*
|
|
||||||
|
|
||||||
Îáíîâëåíèå äàííûõ î êóðñå âíóòðåíåé âàëþòû
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
function getIP() {
|
|
||||||
if(isset($_SERVER['HTTP_X_REAL_IP'])) return $_SERVER['HTTP_X_REAL_IP'];
|
|
||||||
return $_SERVER['REMOTE_ADDR'];
|
|
||||||
}
|
|
||||||
|
|
||||||
# Ïîëó÷àåì IP
|
|
||||||
function getIPblock() {
|
|
||||||
if(isset($_SERVER['HTTP_X_REAL_IP'])) return $_SERVER['HTTP_X_REAL_IP'];
|
|
||||||
return $_SERVER['REMOTE_ADDR'];
|
|
||||||
}
|
|
||||||
|
|
||||||
# Âûïîëíÿåì ïðîâåðêó áåçîïàñíîñòè.
|
|
||||||
|
|
||||||
if(!isset($_GET['robot'])) {
|
|
||||||
//if( $_SERVER['HTTP_CF_CONNECTING_IP'] != $_SERVER['SERVER_ADDR'] && $_SERVER['HTTP_CF_CONNECTING_IP'] != '127.0.0.1' ) { die('Hello pussy!'); }
|
|
||||||
if(getIPblock() != $_SERVER['SERVER_ADDR'] && getIPblock() != '127.0.0.1' && getIPblock() != '' && getIPblock() != '91.228.152.24') {
|
|
||||||
die(getIPblock().'<br>'.$_SERVER['SERVER_ADDR']);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//$curency = 5.21; //êóðñò 1 åêð. ê 1 ðóá. ðô.
|
|
||||||
$true = array(
|
|
||||||
'AUD' => true,
|
|
||||||
'AZN' => true,
|
|
||||||
'AMD' => true,
|
|
||||||
'BYR' => true,
|
|
||||||
'BGN' => true,
|
|
||||||
'BRL' => true,
|
|
||||||
'HUF' => true,
|
|
||||||
'KRW' => true,
|
|
||||||
'DKK' => true,
|
|
||||||
'USD' => true,
|
|
||||||
'EUR' => true,
|
|
||||||
'INR' => true,
|
|
||||||
'KZT' => true,
|
|
||||||
'CAD' => true,
|
|
||||||
'KGS' => true,
|
|
||||||
'CNY' => true,
|
|
||||||
'LVL' => true,
|
|
||||||
'LTL' => true,
|
|
||||||
'MDL' => true,
|
|
||||||
'RON' => true,
|
|
||||||
'TMT' => true,
|
|
||||||
'NOK' => true,
|
|
||||||
'PLN' => true,
|
|
||||||
'XDR' => true,
|
|
||||||
'SGD' => true,
|
|
||||||
'TJS' => true,
|
|
||||||
'TRY' => true,
|
|
||||||
'UZS' => true,
|
|
||||||
'UAH' => true,
|
|
||||||
'GBP' => true,
|
|
||||||
'CZK' => true,
|
|
||||||
'SEK' => true,
|
|
||||||
'CHF' => true,
|
|
||||||
'ZAR' => true,
|
|
||||||
'JPY' => true
|
|
||||||
);
|
|
||||||
|
|
||||||
define('GAME',true);
|
|
||||||
|
|
||||||
setlocale(LC_CTYPE ,"ru_RU.CP1251");
|
|
||||||
|
|
||||||
require_once('_incl_data/__config.php');
|
|
||||||
require_once('_incl_data/class/__db_connect.php');
|
|
||||||
|
|
||||||
//Îáíóëåíèå ïåðåäà÷ ðàç â ñóòêè
|
|
||||||
mysql_query('UPDATE `stats` SET `transfers` = 100 WHERE `transfers` < 200');
|
|
||||||
|
|
||||||
function str_count($str,$col) {
|
|
||||||
if (strlen($str) > $col)
|
|
||||||
{
|
|
||||||
$str = substr($str,0,$col);
|
|
||||||
}
|
|
||||||
return ($str);
|
|
||||||
}
|
|
||||||
|
|
||||||
function getCurs(){
|
|
||||||
// ñîçäàåì îáúåêò äëÿ ðàáîòû ñ XML
|
|
||||||
$xml = new DOMDocument();
|
|
||||||
// ññûëêà íà ñàéò áàíêà
|
|
||||||
$url = 'https://www.cbr.ru/scripts/XML_daily.asp?date_req=' . date('d.m.Y');
|
|
||||||
// ïîëó÷àåì xml ñ êóðñàìè âñåõ âàëþò
|
|
||||||
if ($xml->load($url)){
|
|
||||||
// ìàññèâ äëÿ õðàíåíèÿ êóðñîâ âàëþò
|
|
||||||
$result = array();
|
|
||||||
// ðàçáèðàåì xml
|
|
||||||
$root = $xml->documentElement;
|
|
||||||
// áåðåì âñå òåãè 'Valute' è èõ ñîäåðæèìîå
|
|
||||||
$items = $root->getElementsByTagName('Valute');
|
|
||||||
// ïåðåáåðåì òåãè 'Valute' ïî îäíîìó
|
|
||||||
foreach ($items as $item){
|
|
||||||
// ïîëó÷àåì êîä âàëþòû
|
|
||||||
$code = $item->getElementsByTagName('CharCode')->item(0)->nodeValue;
|
|
||||||
// ïîëó÷àåì çíà÷åíèå êóðñà âàëþòû, îòíîñèòåëüíî ðóáëÿ
|
|
||||||
$value = $item->getElementsByTagName('Value')->item(0)->nodeValue;
|
|
||||||
// íîìèíàë
|
|
||||||
$nominal = $item->getElementsByTagName('Nominal')->item(0)->nodeValue;
|
|
||||||
// çàïèñûâàåì â ìàññèâ, ïðåäâàðèòåëüíî çàìåíèâ çàïÿòóþ íà òî÷êó
|
|
||||||
$result[$code] = round(str_replace(',', '.', $value),5)/$nominal;
|
|
||||||
}
|
|
||||||
// âîçâðàùàåì çíà÷åíèå êóðñà, äëÿ çàïðîøåííîé âàëþòû
|
|
||||||
return $result;
|
|
||||||
}else{
|
|
||||||
// åñëè íå ïîëó÷èëè xml âîçâðàùàåì false
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$get = getCurs();
|
|
||||||
//
|
|
||||||
if( $c['curency_name'] == 'RUB' ) {
|
|
||||||
$curency = $c['curency_value'];
|
|
||||||
}else{
|
|
||||||
$curency = round($get[$c['curency_name']]*$c['curency_value'],4);
|
|
||||||
}
|
|
||||||
//
|
|
||||||
if( $get['USD'] > 0 ) {
|
|
||||||
$price = array(
|
|
||||||
'AUD','AZN','AMD','BYR','BGN','BRL','HUF','KRW','DKK','USD','EUR','INR','KZT','CAD','KGS','CNY','LVL','LTL','MDL','RON','TMT','NOK','PLN','XDR','SGD','TJS','TRY','UZS','UAH','GBP','CZK','SEK','CHF','ZAR','JPY'
|
|
||||||
);
|
|
||||||
$i = 0;
|
|
||||||
while( $i < count($price) ) {
|
|
||||||
if( isset($price[$i]) && $get[$price[$i]] > 0 ) {
|
|
||||||
if( $price[$i] == 'UAH' || $price[$i] == 'BYR' ) {
|
|
||||||
//$get[$price[$i]] -= round($get[$price[$i]]/6,4);
|
|
||||||
}
|
|
||||||
$r .= ',`'.$price[$i].'`="'.$get[$price[$i]].'"';
|
|
||||||
}
|
|
||||||
$i++;
|
|
||||||
}
|
|
||||||
//echo 'INSERT INTO `bank_table` SET `time` = "'.time().'",`cur` = "'.$curency.'",`data` = "'.date('d.m.Y').'"'.$r.'<br>';
|
|
||||||
mysql_query('INSERT INTO `bank_table` SET `time` = "'.time().'",`cur` = "'.$curency.'",`data` = "'.date('d.m.Y').'"'.$r.'');
|
|
||||||
}
|
|
||||||
?>
|
|
@ -1,32 +0,0 @@
|
|||||||
<?php
|
|
||||||
const GAME = true;
|
|
||||||
include('/home/newcom1/public_html/_incl_data/class/__db_connect.php');
|
|
||||||
//11. ÷èñòêà è ñáðîñ ñ÷åò÷èêîâ ïðè îòñóòñòâèè áîåâ ÷òîá íå ëàìàëñß ëîã
|
|
||||||
$test = 0;
|
|
||||||
while ($test == 0) {
|
|
||||||
|
|
||||||
$tbtl = mysql_fetch_array(mysql_query('SELECT * FROM `battle` WHERE `team_win`=-1 ORDER BY `id` LIMIT 1'));
|
|
||||||
echo "<EFBFBD>îé: ";
|
|
||||||
echo $tbtl['id'] . "<br>";
|
|
||||||
if (isset($tbtl['id'])) {
|
|
||||||
sleep(2);
|
|
||||||
} else {
|
|
||||||
mysql_query('UPDATE `users` SET `battle` = 0 WHERE `battle` > 0');
|
|
||||||
mysql_query(
|
|
||||||
'LOCK TABLES `battle_act` WRITE,`battle_end` WRITE,`battle_last` WRITE,`battle_out` WRITE,`battle_stat` WRITE,`battle_users` WRITE,`battle` WRITE,`battle_logs` WRITE,`battle_logs_save` WRITE,`zayvki` WRITE'
|
|
||||||
);
|
|
||||||
mysql_query('TRUNCATE TABLE `battle_act`');
|
|
||||||
mysql_query('TRUNCATE TABLE `battle_end`');
|
|
||||||
mysql_query('TRUNCATE TABLE `battle_last`');
|
|
||||||
mysql_query('TRUNCATE TABLE `battle_out`');
|
|
||||||
mysql_query('TRUNCATE TABLE `battle_stat`');
|
|
||||||
mysql_query('TRUNCATE TABLE `battle_users`');
|
|
||||||
mysql_query('TRUNCATE TABLE `battle`');
|
|
||||||
mysql_query('TRUNCATE TABLE `battle_logs`');
|
|
||||||
mysql_query('TRUNCATE TABLE `battle_logs_save`');
|
|
||||||
mysql_query('TRUNCATE TABLE `zayvki`');
|
|
||||||
mysql_query('UNLOCK TABLES');
|
|
||||||
|
|
||||||
$test = 1;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,80 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
const GAME = true;
|
|
||||||
include('/home/newcom1/public_html/_incl_data/class/__db_connect.php');
|
|
||||||
|
|
||||||
/*
|
|
||||||
|
|
||||||
CRON Çàâåðøåíèå ïîåäèíêà è óäàëåíèå èç çàÿâîê
|
|
||||||
|
|
||||||
*/
|
|
||||||
$hend = 2; //×åðåç ñêîëüêî ÷àñîâ ïðîâåðÿòü è âðåìÿ áåçäåéñòâèÿ
|
|
||||||
|
|
||||||
$sp = mysql_query('SELECT * FROM `battle` WHERE `time_start` < "'.( time() - 1800*$hend ).'" AND `team_win` = -1 LIMIT 100');
|
|
||||||
while( $pl = mysql_fetch_array($sp) ) {
|
|
||||||
$test = mysql_fetch_array(mysql_query('SELECT * FROM `battle_logs` WHERE `battle` = "'.$pl['id'].'" ORDER BY `time` DESC LIMIT 1'));
|
|
||||||
if(!isset($test['id']) || $test['time'] < ( time() - 1800*$hend ) ) {
|
|
||||||
mysql_query('UPDATE `battle` SET `team_win` = "0",`time_over` = "'.time().'" WHERE `id` = "'.$pl['id'].'" LIMIT 1');
|
|
||||||
mysql_query('UPDATE `users` SET `battle` = "0" WHERE `battle` = "'.$pl['id'].'"');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// <20>àñ÷åò òàéìà â íàïàäåíèßõ
|
|
||||||
$sp = mysql_query('SELECT * FROM `battle` WHERE `time_start` < "'.( time() - 180).'" AND `team_win` = -1 AND `typeBattle` = 9 LIMIT 100');
|
|
||||||
while( $pl = mysql_fetch_array($sp) ) {
|
|
||||||
$test = mysql_fetch_array(mysql_query('SELECT COUNT(`u`.`id`) as count
|
|
||||||
FROM `users` AS `u` LEFT JOIN `stats` AS `st` ON (`u`.`id` = `st`.`id`) WHERE `u`.`battle`= "'.$pl['id'].'"'));
|
|
||||||
if ($test['count'] < 8)
|
|
||||||
{
|
|
||||||
mysql_query('UPDATE `battle` SET `timeout` = "60" WHERE `id` = "'.$pl['id'].'" LIMIT 1');
|
|
||||||
}
|
|
||||||
elseif ($test['count'] < 12)
|
|
||||||
{
|
|
||||||
mysql_query('UPDATE `battle` SET `timeout` = "120" WHERE `id` = "'.$pl['id'].'" LIMIT 1');
|
|
||||||
} else {
|
|
||||||
mysql_query('UPDATE `battle` SET `timeout` = "180" WHERE `id` = "' . $pl['id'] . '" LIMIT 1');
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
// batle cache
|
|
||||||
|
|
||||||
mysql_query('DELETE FROM `battle_cache` WHERE `time` < "'.(time()-3600).'"');
|
|
||||||
|
|
||||||
//âûòàñêèâàåì ïåðñîâ èç ïðèç õàîòà åñëè çàñòðßëè (1-5 ìèíóò îêîí÷àíèå)
|
|
||||||
$sp = mysql_fetch_array(mysql_query('SELECT * FROM `battle` WHERE `type` = 33 AND `time_over` < "'.(time()-120).'" AND `time_over` > "'.(time() - 360).'" AND `time_over` != 0 ORDER BY `battle`.`time_over` DESC LIMIT 1'));
|
|
||||||
if (isset($sp['id']))
|
|
||||||
{
|
|
||||||
mysql_query('UPDATE `battle` SET `time_over` = `time_over` - 300 WHERE `id` = "'.$sp['id'].'" LIMIT 1');
|
|
||||||
$sps = mysql_query('SELECT * FROM `users` WHERE `mail` LIKE "haot@new-combats.com" AND `battle` = 0');
|
|
||||||
while( $pl = mysql_fetch_array($sps))
|
|
||||||
{
|
|
||||||
if (isset($pl['id']))
|
|
||||||
{
|
|
||||||
mysql_query('UPDATE `users` SET `inUser` = "0" WHERE `inUser` = "'.$pl['id'].'" LIMIT 1');
|
|
||||||
mysql_query('DELETE FROM `users` WHERE `id` = "'.$pl['id'].'" LIMIT 1');
|
|
||||||
mysql_query('DELETE FROM `stats` WHERE `id` = "'.$pl['id'].'" LIMIT 1');
|
|
||||||
mysql_query('DELETE FROM `items_users` WHERE `uid` = "'.$pl['id'].'" LIMIT 100');
|
|
||||||
mysql_query('DELETE FROM `eff_users` WHERE `uid` = "'.$pl['id'].'" LIMIT 100');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//‚ûòàñêèâàåì ïåðñîâ åñëè çàñòðßëè â áîßõ
|
|
||||||
$sps = mysql_query('SELECT * FROM `users` WHERE `battle` > 0');
|
|
||||||
while( $pl = mysql_fetch_array($sps))
|
|
||||||
{
|
|
||||||
if (isset($pl['id']))
|
|
||||||
{
|
|
||||||
$test = mysql_fetch_array(mysql_query('SELECT * FROM `battle` WHERE `id` = "'.$pl['battle'].'" LIMIT 1'));
|
|
||||||
if (($test['time_over'] < (time()-600) && $test['time_over'] !=0) || !isset($test['id']))
|
|
||||||
{
|
|
||||||
mysql_query('UPDATE `users` SET `battle`= 0 WHERE `id` = "'.$pl['id'].'" LIMIT 1');
|
|
||||||
mysql_query('UPDATE `stats` SET `battle_yron` = 0 WHERE `id` = "'.$pl['id'].'" LIMIT 1');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//÷èñòèì ïàìßòü
|
|
||||||
unset($sp,$sps,$pl,$test);
|
|
||||||
|
|
@ -1,21 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
/** Îïòèìèçèðîâàíî.
|
|
||||||
* ×èñòêà è ñáðîñ ñ÷åò÷èêîâ ïðè îòñóòñòâèè áîåâ ÷òîá íå ëàìàëñÿ ëîã.
|
|
||||||
* @var PDO $pdo
|
|
||||||
* @author Insallah
|
|
||||||
*/
|
|
||||||
const GAME = true;
|
|
||||||
define('DAY', 24 * 60 * 60);
|
|
||||||
include('/home/newcom1/public_html/_incl_data/class/__db_connect.php');
|
|
||||||
|
|
||||||
$tables = ['battle_end', 'battle_last', 'battle_out', 'battle_stat', 'battle_logs', 'battle_logs_save'];
|
|
||||||
$q = [
|
|
||||||
'delete from battle_users where time_enter < unix_timestamp() - ? and time_enter != 0',
|
|
||||||
'delete from battle where time_over < unix_timestamp() - ? and time_over != 0',
|
|
||||||
];
|
|
||||||
foreach ($tables as $table) {
|
|
||||||
$pdo->prepare("delete from $table where time < unix_timestamp() - ?")->execute(DAY);
|
|
||||||
}
|
|
||||||
$pdo->prepare($q[0])->execute(DAY);
|
|
||||||
$pdo->prepare($q[1])->execute(DAY);
|
|
@ -1,126 +0,0 @@
|
|||||||
<?php
|
|
||||||
const GAME = true;
|
|
||||||
include('/home/newcom1/public_html/_incl_data/class/__db_connect.php');
|
|
||||||
|
|
||||||
/*
|
|
||||||
|
|
||||||
CRON Î÷èñòêè ñåðâåðà îò íåíóæíîé èíôîðìàöèè
|
|
||||||
Äåéñòâèÿ:
|
|
||||||
1. Î÷èñòêà ÷àòà
|
|
||||||
2. Î÷èñòêà çàÿâîê â ïîåäèíêè
|
|
||||||
3. Î÷èñòêà çàÿâîê â ïåùåðû
|
|
||||||
4. Î÷èñòêà ïîõîäîâ
|
|
||||||
5. <EFBFBD>îåâ äî òåêóùèõ
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
// ‡àßâêè â êëàí
|
|
||||||
mysql_query('UPDATE `users` SET `clan_zv`=0 WHERE `clan_zv`>0');
|
|
||||||
|
|
||||||
//1. Î÷èñòêà ÷àòà, îñòàåòñÿ ÷àò
|
|
||||||
mysql_query('DELETE FROM `chat` WHERE `time` < "'.(time()-1000).'"');
|
|
||||||
mysql_query('DELETE FROM `chat_system` WHERE `time` < "'.(time()-1000).'"');
|
|
||||||
|
|
||||||
//2. Î÷èñòêà çàÿâîê â ïîåäèíêè
|
|
||||||
mysql_query('DELETE FROM `zayvki` WHERE `start` > 0 OR `cancel` > 0 OR `time` < "'.(time()-43200*1).'"');
|
|
||||||
|
|
||||||
//3. Î÷èñòêà çàÿâîê â ïåùåðû
|
|
||||||
mysql_query('DELETE FROM `dungeon_zv` WHERE `delete` > 0 OR `time` < "'.(time()-43200*1).'"');
|
|
||||||
|
|
||||||
//4. Î÷èñòêà ïîõîäîâ
|
|
||||||
$sp = mysql_query('SELECT * FROM `dungeon_now` WHERE `time_start` < "'.(time()-43200*1).'" OR `time_finish` > 0');
|
|
||||||
while( $pl = mysql_fetch_array($sp) ) {
|
|
||||||
mysql_query('DELETE FROM `dungeon_actions` WHERE `dn` = "'.$pl['id'].'"');
|
|
||||||
mysql_query('DELETE FROM `dungeon_bots` WHERE `dn` = "'.$pl['id'].'"');
|
|
||||||
mysql_query('DELETE FROM `dungeon_items` WHERE `dn` = "'.$pl['id'].'"');
|
|
||||||
mysql_query('DELETE FROM `dungeon_obj` WHERE `dn` = "'.$pl['id'].'"');
|
|
||||||
mysql_query('DELETE FROM `dungeon_now` WHERE `id` = "'.$pl['id'].'"');
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//5. Î÷èñòêà áàíîâ - 10 äíåé
|
|
||||||
$dusr = mysql_query('SELECT * FROM `users` WHERE `banned` < "'.(time()-86400*10).'" AND `banned` > 0');
|
|
||||||
while( $ddusr = mysql_fetch_array($dusr) ) {
|
|
||||||
|
|
||||||
mysql_query('DELETE FROM `items_users` WHERE `uid` = "'.$ddusr['id'].'"');
|
|
||||||
mysql_query('DELETE FROM `eff_users` WHERE `uid` = "'.$ddusr['id'].'"');
|
|
||||||
|
|
||||||
//“äàëßåì ñòàòû è ïîëå â þçåðñ
|
|
||||||
mysql_query('DELETE FROM `users` WHERE `id` = "'.$ddusr['id'].'" LIMIT 1');
|
|
||||||
mysql_query('DELETE FROM `rep` WHERE `id` = "'.$ddusr['id'].'" LIMIT 1');
|
|
||||||
mysql_query('DELETE FROM `stats` WHERE `id` = "'.$ddusr['id'].'" LIMIT 1');
|
|
||||||
mysql_query('DELETE FROM `online` WHERE `uid` = "'.$ddusr['id'].'" LIMIT 1');
|
|
||||||
mysql_query('DELETE FROM `actions` WHERE `uid` = "'.$ddusr['id'].'" LIMIT 1');
|
|
||||||
}
|
|
||||||
//6. ÷èñòêà îòñóòñòâóþùèç 30 äíåé
|
|
||||||
|
|
||||||
$dusr = mysql_query('SELECT * FROM `users` WHERE `online` < "'.(time()-86400*30).'" AND `online` > 0 AND `level` < 10');
|
|
||||||
while( $ddusr = mysql_fetch_array($dusr) ) {
|
|
||||||
|
|
||||||
mysql_query('DELETE FROM `items_users` WHERE `uid` = "'.$ddusr['id'].'"');
|
|
||||||
mysql_query('DELETE FROM `eff_users` WHERE `uid` = "'.$ddusr['id'].'"');
|
|
||||||
|
|
||||||
//“äàëßåì ñòàòû è ïîëå â þçåðñ
|
|
||||||
mysql_query('DELETE FROM `users` WHERE `id` = "'.$ddusr['id'].'" LIMIT 1');
|
|
||||||
mysql_query('DELETE FROM `rep` WHERE `id` = "'.$ddusr['id'].'" LIMIT 1');
|
|
||||||
mysql_query('DELETE FROM `stats` WHERE `id` = "'.$ddusr['id'].'" LIMIT 1');
|
|
||||||
mysql_query('DELETE FROM `online` WHERE `uid` = "'.$ddusr['id'].'" LIMIT 1');
|
|
||||||
mysql_query('DELETE FROM `actions` WHERE `uid` = "'.$ddusr['id'].'" LIMIT 1');
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
//7. ÷èñòêà ßâíûõ áîòîâ
|
|
||||||
|
|
||||||
mysql_query('DELETE FROM `users` WHERE `ip` = "0" AND `online` = "0" AND `battle` = "0"');
|
|
||||||
|
|
||||||
//8. ÷èñòêà ëîãîâ ïåðåäà÷ -10 äíåé
|
|
||||||
|
|
||||||
mysql_query('DELETE FROM `users_delo` WHERE `time` < "'.(time()-86400*10).'"');
|
|
||||||
|
|
||||||
//9. ÷èñòêà âåùåé íåïðåíàäëåæàùèõ íå êîìó
|
|
||||||
|
|
||||||
mysql_query('DELETE FROM `items_users` WHERE `items_users`.`uid` > 0 AND `items_users`.`uid` NOT IN (SELECT `users`.`id` FROM `users`)');
|
|
||||||
//mysql_query('OPTIMIZE TABLE `items_users`');
|
|
||||||
|
|
||||||
//9.1. ÷èñòêà ýôåêòîâ
|
|
||||||
|
|
||||||
mysql_query('DELETE FROM `eff_users` WHERE `eff_users`.`uid` > 0 AND `eff_users`.`uid` NOT IN (SELECT `users`.`id` FROM `users`)');
|
|
||||||
//mysql_query('OPTIMIZE TABLE `eff_users`');
|
|
||||||
//9.2. ÷èñòêà users_achiv
|
|
||||||
|
|
||||||
mysql_query('DELETE FROM `users_achiv` WHERE `users_achiv`.`id` > 0 AND `users_achiv`.`id` NOT IN (SELECT `users`.`id` FROM `users`)');
|
|
||||||
//mysql_query('OPTIMIZE TABLE `users_achiv`');
|
|
||||||
//9.3. ÷èñòêà aaa_bonus
|
|
||||||
|
|
||||||
mysql_query('DELETE FROM `aaa_bonus` WHERE `aaa_bonus`.`uid` > 0 AND `aaa_bonus`.`uid` NOT IN (SELECT `users`.`id` FROM `users`)');
|
|
||||||
//mysql_query('OPTIMIZE TABLE `aaa_bonus`');
|
|
||||||
//9.4. ÷èñòêà `users_delo`
|
|
||||||
mysql_query('DELETE FROM `users_delo` WHERE `users_delo`.`uid` > 0 AND `users_delo`.`uid` NOT IN (SELECT `users`.`id` FROM `users`)');
|
|
||||||
//mysql_query('OPTIMIZE TABLE `users_delo`');
|
|
||||||
//9.5. ÷èñòêà users_reting
|
|
||||||
mysql_query('DELETE FROM `users_reting` WHERE `users_reting`.`uid` > 0 AND `users_reting`.`uid` NOT IN (SELECT `users`.`id` FROM `users`)');
|
|
||||||
//mysql_query('OPTIMIZE TABLE `users_reting`');
|
|
||||||
//9.6. ÷èñòêà `aaa_reting_list`
|
|
||||||
mysql_query('DELETE FROM `aaa_reting_list` WHERE `aaa_reting_list`.`uid` > 0 AND `aaa_reting_list`.`uid` NOT IN (SELECT `users`.`id` FROM `users`)');
|
|
||||||
//mysql_query('OPTIMIZE TABLE `aaa_reting_list`');
|
|
||||||
//9.7 rep
|
|
||||||
mysql_query('DELETE FROM `rep` WHERE `rep`.`id` > 0 AND `rep`.`id` NOT IN (SELECT `users`.`id` FROM `users`)');
|
|
||||||
//mysql_query('OPTIMIZE TABLE `rep`');
|
|
||||||
//9.8 aaa_znahar
|
|
||||||
mysql_query('DELETE FROM `aaa_znahar` WHERE `aaa_znahar`.`uid` > 0 AND `aaa_znahar`.`uid` NOT IN (SELECT `users`.`id` FROM `users`)');
|
|
||||||
//mysql_query('OPTIMIZE TABLE `aaa_znahar`');
|
|
||||||
//9.9 user_operation
|
|
||||||
mysql_query('DELETE FROM `user_operation` WHERE `user_operation`.`uid` > 0 AND `user_operation`.`uid` NOT IN (SELECT `users`.`id` FROM `users`)');
|
|
||||||
//mysql_query('OPTIMIZE TABLE `user_operation`');
|
|
||||||
|
|
||||||
//10. ÷èñòêà actions
|
|
||||||
|
|
||||||
mysql_query('DELETE FROM `actions` WHERE `vars`= "day_quest"');
|
|
||||||
mysql_query('DELETE FROM `actions` WHERE `time` < "'.(time()-86400*60).'" AND `vars` != "read"');
|
|
||||||
mysql_query('DELETE FROM `actions` WHERE `actions`.`uid` > 0 AND `actions`.`uid` NOT IN (SELECT `users`.`id` FROM `users`)');
|
|
||||||
mysql_query('DELETE FROM `actions` WHERE `vals`= "loto"');
|
|
||||||
//mysql_query('OPTIMIZE TABLE `actions`');
|
|
||||||
//—èñòêà ãîëîñîâîãî ÷àòà
|
|
||||||
|
|
||||||
mysql_query('DELETE FROM `uploads` WHERE `id` > 0');
|
|
||||||
|
|
@ -1,43 +0,0 @@
|
|||||||
<?php
|
|
||||||
/** Îïòèìèçèðîâàíî. Íî êàê-òî õåðîâàòî. Íàäî îòêàçàòüñÿ îò âûçîâà $u. È çàïðîñû êàêèå-òî âðàçíîáîé, íàäî ðàçáèðàòüñÿ.
|
|
||||||
* CRON Êîìèññèîííîãî ìàãàçèíà
|
|
||||||
* Åñëè ïðåäìåò âèñèò óæå 2 è áîëåå íåäåëü, ïðîäàâàòü ïðåäìåò çà 50% îò åãî ñòîèìîñòè ñ ó÷åòîì èçíîñà.
|
|
||||||
* Äåíüãè îòñûëàþòñÿ íà ïî÷òó.
|
|
||||||
* @var PDO $pdo
|
|
||||||
* @author Insallah
|
|
||||||
*/
|
|
||||||
const GAME = true;
|
|
||||||
const RETURN_GROUP = '"<span style="color: #C65F00;">Shop.capitalcity</span>": Âîçâðàò èç êîìèññèîííîãî ìàãàçèíà ïðåäìåò: [id="%s"/ Íàçâàíèå : "%s"/ Öåíà : "%s"/ Ãðóïåðîâàííî : "$s"].';
|
|
||||||
const RETURN_ONE = '"<span style="color: #C65F00;">Shop.capitalcity</span>": Âîçâðàò èç êîìèññèîííîãî ìàãàçèíà ïðåäìåò: [id="%s"/ Íàçâàíèå : "%s"/ Öåíà : "%s"].';
|
|
||||||
const SHOP_TYPE = 'Shop.comission';
|
|
||||||
setlocale(LC_CTYPE, "ru_RU.CP1251");
|
|
||||||
include('/home/newcom1/public_html/_incl_data/__config.php');
|
|
||||||
include('/home/newcom1/public_html/_incl_data/class/__db_connect.php');
|
|
||||||
$u = User::start();
|
|
||||||
|
|
||||||
$q = 'select items_main.id, uid, inGroup, item_id, price1, name from items_users left join items_main on items_main.id = item_id where inShop = 30 and `delete` = 0';
|
|
||||||
foreach ($pdo->query($q) as $row) {
|
|
||||||
if ($row['inGroup']) {
|
|
||||||
$col = $u->itemsX($row['id']);
|
|
||||||
if ($col > 1) {
|
|
||||||
$stmt = $pdo->prepare('update items_users set inShop = 0, 1price = ? where item_id = ? and inShop = 30 and uid = ? and inGroup = ? limit ' . $col);
|
|
||||||
if ($stmt->execute([$row['price1'], $row['item_id'], $row['uid'], $row['inGroup']])) {
|
|
||||||
$ld = $u->addDelo(1, $row['uid'],
|
|
||||||
sprintf(RETURN_GROUP, $row['item_id'], $row['name'], $row['price1'], $row['inGroup'] . '+1'),
|
|
||||||
time(), $u->info['city'], SHOP_TYPE, 0, 0);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
$stmt = $pdo->prepare('update items_users set inShop = 0, 1price = ? where uid = ? and id = ? and inOdet = 0 and `delete` = 0 and inShop = 30');
|
|
||||||
if ($stmt->execute([$row['price1'], $row['uid'], $row['id']])) {
|
|
||||||
$ld = $u->addDelo(1, $row['uid'], sprintf(RETURN_ONE, $row['item_id'], $row['name'], $row['price1']),
|
|
||||||
time(), $u->info['city'], SHOP_TYPE, 0, 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
$stmt = $pdo->prepare('update items_users set inShop = 0, 1price = ? where id = ? and inShop = 30');
|
|
||||||
if ($stmt->execute([$row['price1'], $row['id']])) {
|
|
||||||
$ld = $u->addDelo(1, $row['uid'], sprintf(RETURN_ONE, $row['item_id'], $row['name'], $row['price1']),
|
|
||||||
time(), $u->info['city'], SHOP_TYPE, 0, 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,2 +0,0 @@
|
|||||||
;display_errors = on
|
|
||||||
;error_reporting = E_ALL & ~E_NOTICE
|
|
@ -1,31 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
/** Îïòèìèçèðîâàíî. Õîòÿ íåÿñíî ÷òî ýòî äåëàåò.
|
|
||||||
* @var PDO $pdo
|
|
||||||
* @author Insallah
|
|
||||||
*/
|
|
||||||
const GAME = true;
|
|
||||||
include('/home/newcom1/public_html/_incl_data/class/__db_connect.php');
|
|
||||||
|
|
||||||
$q = [
|
|
||||||
'select id from rep where repemeraldscity > 1999 order by add_stats desc',
|
|
||||||
'update rep set
|
|
||||||
nu_capitalcity = 0,
|
|
||||||
nu_demonscity = 0,
|
|
||||||
nu_angelscity = 0,
|
|
||||||
nu_suncity = 0,
|
|
||||||
nu_dreamscity = 0,
|
|
||||||
nu_abandonedplain = 0,
|
|
||||||
nu_sandcity = 0,
|
|
||||||
nu_emeraldscity = 0,
|
|
||||||
add_stats = 0,
|
|
||||||
add_skills = 0,
|
|
||||||
add_slot = 0
|
|
||||||
where id = ?',
|
|
||||||
];
|
|
||||||
|
|
||||||
$correct = $pdo->prepare($q[1]);
|
|
||||||
foreach ($pdo->query($q[0]) as $row) {
|
|
||||||
echo 'id: ' . $row['id'] . '<br>';
|
|
||||||
$correct->execute($row['id']);
|
|
||||||
}
|
|
@ -1,90 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
const GAME = true;
|
|
||||||
setlocale(LC_CTYPE ,"ru_RU.CP1251");
|
|
||||||
include('/home/newcom1/public_html/_incl_data/class/__db_connect.php');
|
|
||||||
|
|
||||||
$sp = mysql_query('SELECT * FROM `stats` WHERE `priemslot` > 10');
|
|
||||||
while( $pl = mysql_fetch_array($sp) ) {
|
|
||||||
$test = mysql_fetch_array(mysql_query('SELECT * FROM `rep` WHERE `id` = "'.$pl['id'].'" LIMIT 1'));
|
|
||||||
$userst = mysql_fetch_array(mysql_query('SELECT * FROM `users` WHERE `id` = "'.$pl['id'].'" LIMIT 1'));
|
|
||||||
$kolvo = mysql_fetch_array(mysql_query('SELECT COUNT(*) FROM `actions` WHERE `uid` ="'.$pl['id'].'" AND `vars` ="read"'));
|
|
||||||
$overtop=$pl['priemslot']-10-$test['add_slot']-($kolvo['COUNT(*)']+1);
|
|
||||||
$overtopkorrect=$pl['priemslot']-10-$test['add_slot'];
|
|
||||||
$prevish = $overtop > 8 ? $overtop - 8 : 0;
|
|
||||||
if ($overtopkorrect>8){$overtopkorrect=8;}
|
|
||||||
$resultslot= 10 + $test['add_slot'] + $overtopkorrect;
|
|
||||||
if($overtop>0)
|
|
||||||
{
|
|
||||||
|
|
||||||
echo "íà÷àëî!!! íèê:".$userst['login']." êîëè÷åñòâî ñëîòîâ:".$pl['priemslot']." äîëæíî áûòü:".$resultslot." êîëè÷åñòâî äîáàâëåííûõ ñ ïîäçåìêè ñëîòîâ:".$test['add_slot']." êîëè÷åñòâî ïðî÷èòàíûõ êíèã:".$kolvo['COUNT(*)']." ðåçóëüòàò:".$overtop." ïðåâûøåíèå:".$prevish." íóæíî ïðî÷èòàòü:".$overtopkorrect."<br>";
|
|
||||||
|
|
||||||
mysql_query('UPDATE `stats` SET `priemslot` = "'.$resultslot.'" WHERE `id` = "'.$pl['id'].'"');
|
|
||||||
mysql_query('DELETE FROM `actions` WHERE `uid` = "'.$pl['id'].'" AND `vars` = "read" ');
|
|
||||||
|
|
||||||
if($overtopkorrect==5){$overtopkorrect=6;}
|
|
||||||
|
|
||||||
if ($overtopkorrect==1)
|
|
||||||
{
|
|
||||||
mysql_query('INSERT INTO `actions`(`uid`, `time`, `city`, `room`, `vars`, `vals`) VALUES ("'.$pl['id'].'","'.time().'","capitalcity","10","read","1044")');
|
|
||||||
}
|
|
||||||
elseif ($overtopkorrect==2)
|
|
||||||
{
|
|
||||||
mysql_query('INSERT INTO `actions`(`uid`, `time`, `city`, `room`, `vars`, `vals`) VALUES ("'.$pl['id'].'","'.time().'","capitalcity","10","read","1044")');
|
|
||||||
mysql_query('INSERT INTO `actions`(`uid`, `time`, `city`, `room`, `vars`, `vals`) VALUES ("'.$pl['id'].'","'.time().'","capitalcity","10","read","1045")');
|
|
||||||
}
|
|
||||||
elseif ($overtopkorrect==3)
|
|
||||||
{
|
|
||||||
mysql_query('INSERT INTO `actions`(`uid`, `time`, `city`, `room`, `vars`, `vals`) VALUES ("'.$pl['id'].'","'.time().'","capitalcity","10","read","1044")');
|
|
||||||
mysql_query('INSERT INTO `actions`(`uid`, `time`, `city`, `room`, `vars`, `vals`) VALUES ("'.$pl['id'].'","'.time().'","capitalcity","10","read","1045")');
|
|
||||||
mysql_query('INSERT INTO `actions`(`uid`, `time`, `city`, `room`, `vars`, `vals`) VALUES ("'.$pl['id'].'","'.time().'","capitalcity","10","read","1046")');
|
|
||||||
}
|
|
||||||
elseif ($overtopkorrect==4)
|
|
||||||
{
|
|
||||||
mysql_query('INSERT INTO `actions`(`uid`, `time`, `city`, `room`, `vars`, `vals`) VALUES ("'.$pl['id'].'","'.time().'","capitalcity","10","read","1044")');
|
|
||||||
mysql_query('INSERT INTO `actions`(`uid`, `time`, `city`, `room`, `vars`, `vals`) VALUES ("'.$pl['id'].'","'.time().'","capitalcity","10","read","1045")');
|
|
||||||
mysql_query('INSERT INTO `actions`(`uid`, `time`, `city`, `room`, `vars`, `vals`) VALUES ("'.$pl['id'].'","'.time().'","capitalcity","10","read","1046")');
|
|
||||||
mysql_query('INSERT INTO `actions`(`uid`, `time`, `city`, `room`, `vars`, `vals`) VALUES ("'.$pl['id'].'","'.time().'","capitalcity","10","read","1047")');
|
|
||||||
}
|
|
||||||
elseif ($overtopkorrect==6)
|
|
||||||
{
|
|
||||||
mysql_query('INSERT INTO `actions`(`uid`, `time`, `city`, `room`, `vars`, `vals`) VALUES ("'.$pl['id'].'","'.time().'","capitalcity","10","read","1044")');
|
|
||||||
mysql_query('INSERT INTO `actions`(`uid`, `time`, `city`, `room`, `vars`, `vals`) VALUES ("'.$pl['id'].'","'.time().'","capitalcity","10","read","1045")');
|
|
||||||
mysql_query('INSERT INTO `actions`(`uid`, `time`, `city`, `room`, `vars`, `vals`) VALUES ("'.$pl['id'].'","'.time().'","capitalcity","10","read","1046")');
|
|
||||||
mysql_query('INSERT INTO `actions`(`uid`, `time`, `city`, `room`, `vars`, `vals`) VALUES ("'.$pl['id'].'","'.time().'","capitalcity","10","read","1047")');
|
|
||||||
|
|
||||||
|
|
||||||
mysql_query('INSERT INTO `actions`(`uid`, `time`, `city`, `room`, `vars`, `vals`) VALUES ("'.$pl['id'].'","'.time().'","capitalcity","10","read","4811")');
|
|
||||||
}
|
|
||||||
elseif ($overtopkorrect==7)
|
|
||||||
{
|
|
||||||
|
|
||||||
mysql_query('INSERT INTO `actions`(`uid`, `time`, `city`, `room`, `vars`, `vals`) VALUES ("'.$pl['id'].'","'.time().'","capitalcity","10","read","1044")');
|
|
||||||
mysql_query('INSERT INTO `actions`(`uid`, `time`, `city`, `room`, `vars`, `vals`) VALUES ("'.$pl['id'].'","'.time().'","capitalcity","10","read","1045")');
|
|
||||||
mysql_query('INSERT INTO `actions`(`uid`, `time`, `city`, `room`, `vars`, `vals`) VALUES ("'.$pl['id'].'","'.time().'","capitalcity","10","read","1046")');
|
|
||||||
mysql_query('INSERT INTO `actions`(`uid`, `time`, `city`, `room`, `vars`, `vals`) VALUES ("'.$pl['id'].'","'.time().'","capitalcity","10","read","1047")');
|
|
||||||
|
|
||||||
|
|
||||||
mysql_query('INSERT INTO `actions`(`uid`, `time`, `city`, `room`, `vars`, `vals`) VALUES ("'.$pl['id'].'","'.time().'","capitalcity","10","read","4811")');
|
|
||||||
mysql_query('INSERT INTO `actions`(`uid`, `time`, `city`, `room`, `vars`, `vals`) VALUES ("'.$pl['id'].'","'.time().'","capitalcity","10","read","4812")');
|
|
||||||
|
|
||||||
}
|
|
||||||
elseif ($overtopkorrect==8)
|
|
||||||
{
|
|
||||||
|
|
||||||
mysql_query('INSERT INTO `actions`(`uid`, `time`, `city`, `room`, `vars`, `vals`) VALUES ("'.$pl['id'].'","'.time().'","capitalcity","10","read","1044")');
|
|
||||||
mysql_query('INSERT INTO `actions`(`uid`, `time`, `city`, `room`, `vars`, `vals`) VALUES ("'.$pl['id'].'","'.time().'","capitalcity","10","read","1045")');
|
|
||||||
mysql_query('INSERT INTO `actions`(`uid`, `time`, `city`, `room`, `vars`, `vals`) VALUES ("'.$pl['id'].'","'.time().'","capitalcity","10","read","1046")');
|
|
||||||
mysql_query('INSERT INTO `actions`(`uid`, `time`, `city`, `room`, `vars`, `vals`) VALUES ("'.$pl['id'].'","'.time().'","capitalcity","10","read","1047")');
|
|
||||||
|
|
||||||
|
|
||||||
mysql_query('INSERT INTO `actions`(`uid`, `time`, `city`, `room`, `vars`, `vals`) VALUES ("'.$pl['id'].'","'.time().'","capitalcity","10","read","4811")');
|
|
||||||
mysql_query('INSERT INTO `actions`(`uid`, `time`, `city`, `room`, `vars`, `vals`) VALUES ("'.$pl['id'].'","'.time().'","capitalcity","10","read","4812")');
|
|
||||||
mysql_query('INSERT INTO `actions`(`uid`, `time`, `city`, `room`, `vars`, `vals`) VALUES ("'.$pl['id'].'","'.time().'","capitalcity","10","read","4813")');
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
echo "ðåçóëüòàò!!! íèê:".$userst['login']." êîëè÷åñòâî ñëîòîâ:".$resultslot." êîëè÷åñòâî äîáàâëåííûõ ñ ïîäçåìêè ñëîòîâ:".$test['add_slot']." êîëè÷åñòâî ïðî÷èòàíûõ êíèã:".$overtopkorrect."<br>";
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,66 +0,0 @@
|
|||||||
<?php
|
|
||||||
/*
|
|
||||||
|
|
||||||
ßäðî äëÿ îáðàáîòêè äàííûõ.
|
|
||||||
Îáðàáîòêà ïîåäèíêîâ, îáðàáîòêà çàÿâîê, îáðàáîòêà áîòîâ, îáðàáîòêà ïåùåð, îáðàáîòêà òóðíèðîâ, îáðàáîòêà âðåìåííûõ ãåíåðàöèé
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
const GAME = true;
|
|
||||||
require_once('_incl_data/__config.php');
|
|
||||||
require_once('_incl_data/class/__db_connect.php');
|
|
||||||
|
|
||||||
if (UserIp::get() != $_SERVER['SERVER_ADDR'] && UserIp::get() != '127.0.0.1' && UserIp::get() != '' && UserIp::get(
|
|
||||||
) != '5.187.7.71' && !isset($_GET['test'])) {
|
|
||||||
die(UserIp::get() . '<br>' . $_SERVER['SERVER_ADDR']);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
function e($t)
|
|
||||||
{
|
|
||||||
mysql_query(
|
|
||||||
'INSERT INTO `chat` (`text`,`city`,`to`,`type`,`new`,`time`) VALUES ("core #' . date('d.m.Y') . ' %' . date(
|
|
||||||
'H:i:s'
|
|
||||||
) . ' (Êðèòè÷åñêàÿ îøèáêà): <b>' . mysql_real_escape_string($t) . '</b>","capitalcity","LEL","6","1","-1")'
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
$count = [
|
|
||||||
0, //çàâåðøåííûõ ïîåäèíêîâ
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
];
|
|
||||||
|
|
||||||
function clear_user($plid)
|
|
||||||
{
|
|
||||||
mysql_query('UPDATE `users` SET `login` = "delete",`login2` = `login` WHERE `id` = ' . $plid);
|
|
||||||
}
|
|
||||||
|
|
||||||
function inuser_go_btl($id)
|
|
||||||
{
|
|
||||||
if (isset($id['id'])) {
|
|
||||||
echo file_get_contents(
|
|
||||||
'https://new-combats.com/jx/battle/refresh.php?uid=' . $id['id'] . '&cron_core=' . md5(
|
|
||||||
$id['id'] . '_brfCOreW@!_' . $id['pass']
|
|
||||||
) . '&pass=' . $id['pass']
|
|
||||||
);
|
|
||||||
echo '<hr>';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ñ÷èòàåì ïîåäèíêè */
|
|
||||||
//e('îáðàáîòêà îòìåíåíà.');
|
|
||||||
$i = 0;
|
|
||||||
while ($i < 3) {
|
|
||||||
$sp = mysql_query(
|
|
||||||
'SELECT `id`,`time_start` FROM `battle` WHERE `team_win` = "-1" AND `time_over` = "0" AND `type` = 329 LIMIT 100'
|
|
||||||
);
|
|
||||||
while ($pl = mysql_fetch_array($sp)) {
|
|
||||||
$user1 = mysql_fetch_array(mysql_query('SELECT * FROM `users` WHERE `battle` = "' . $pl['id'] . '" LIMIT 1'));
|
|
||||||
inuser_go_btl($user1);
|
|
||||||
}
|
|
||||||
$i++;
|
|
||||||
}
|
|
@ -1,67 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
function getIP()
|
|
||||||
{
|
|
||||||
return getIPblock();
|
|
||||||
}
|
|
||||||
|
|
||||||
# Ïîëó÷àåì IP
|
|
||||||
function getIPblock()
|
|
||||||
{
|
|
||||||
return isset($_SERVER['HTTP_X_REAL_IP']) ? $_SERVER['HTTP_X_REAL_IP'] : $_SERVER['REMOTE_ADDR'];
|
|
||||||
}
|
|
||||||
|
|
||||||
# Âûïîëíÿåì ïðîâåðêó áåçîïàñíîñòè.
|
|
||||||
|
|
||||||
if (getIPblock() != $_SERVER['SERVER_ADDR'] && getIPblock() != '127.0.0.1' && getIPblock() != '' && getIPblock(
|
|
||||||
) != '31.131.97.206') {
|
|
||||||
die(getIPblock() . '<br>' . $_SERVER['SERVER_ADDR']);
|
|
||||||
}
|
|
||||||
|
|
||||||
const GAME = true;
|
|
||||||
|
|
||||||
include('_incl_data/__config.php');
|
|
||||||
include('_incl_data/class/__db_connect.php');
|
|
||||||
$u = User::start();
|
|
||||||
|
|
||||||
$sp = mysql_query(
|
|
||||||
'SELECT `u`.*,`s`.*,`u`.`id`,`s`.`id` FROM `users` AS `u` LEFT JOIN `stats` AS `s` ON ( `s`.`id` = `u`.`id` AND `s`.`bot` = 0 ) WHERE `login` = "Crowley"'
|
|
||||||
);
|
|
||||||
while ($pl = mysql_fetch_array($sp)) {
|
|
||||||
if ($pl['inUser'] > 0 && $pl['inTurnir'] > 0) {
|
|
||||||
$txt = '<font color=red>Âíèìàíèå!</font><b><font color=darkgreen><u>Âñå ïîäçåìåëüÿ çàêðûòû, íà÷èíàåòñÿ ìÿñîðóáêà!</u></font></b>';
|
|
||||||
mysql_query(
|
|
||||||
"INSERT INTO `chat` (`new`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`,`typeTime`) VALUES (1,'" . $u->info['city'] . "','" . $u->info['room'] . "','','','" . $txt . "','" . time(
|
|
||||||
) . "','6','0','1')"
|
|
||||||
);
|
|
||||||
}
|
|
||||||
if ($pl['dnow'] > 0) {
|
|
||||||
//ñîõðàíÿåì êîîðäèíàòû è ïåùåðó â êîòîðîé áûë äî ìÿñîðóáêè
|
|
||||||
mysql_query(
|
|
||||||
'INSERT INTO `save_dungeon` (`x`,`y`,`dnow`,`time`,`uid`) VALUES ("' . $pl['x'] . '","' . $pl['y'] . '","' . $pl['dnow'] . '","' . time(
|
|
||||||
) . '","' . $pl['id'] . '")'
|
|
||||||
);
|
|
||||||
//
|
|
||||||
mysql_query('UPDATE `stats` SET `dnow` = "0" WHERE `id` = "' . $pl['id'] . '"');
|
|
||||||
mysql_query('UPDATE `users` SET `room` = "9",`battle` = "0" WHERE `id` = "' . $pl['id'] . '"');
|
|
||||||
//óäàëÿåì ýôôåêòû è ïîåäèíêè
|
|
||||||
mysql_query('DELETE FROM `eff_users` WHERE `uid` = "' . $pl['id'] . '" AND `v1` = "priem" AND `delete` = "0"');
|
|
||||||
mysql_query('DELETE FROM `battle` WHERE `id` = "' . $pl['battle'] . '"');
|
|
||||||
mysql_query('DELETE FROM `battle_act` WHERE `battle` = "' . $pl['battle'] . '"');
|
|
||||||
mysql_query(
|
|
||||||
'DELETE FROM `battle_actions` WHERE `btl` = "' . $pl['battle'] . '" AND `uid` = "' . $pl['id'] . '"'
|
|
||||||
);
|
|
||||||
mysql_query('DELETE FROM `battle_end` WHERE `battle_id` = "' . $pl['battle'] . '"');
|
|
||||||
mysql_query('DELETE FROM `battle_last` WHERE `battle_id` = "' . $pl['battle'] . '"');
|
|
||||||
mysql_query('DELETE FROM `battle_logs` WHERE `battle` = "' . $pl['battle'] . '"');
|
|
||||||
mysql_query('DELETE FROM `battle_out` WHERE `battle` = "' . $pl['battle'] . '"');
|
|
||||||
mysql_query('DELETE FROM `battle_stat` WHERE `battle` = "' . $pl['battle'] . '"');
|
|
||||||
mysql_query('DELETE FROM `battle_users` WHERE `battle` = "' . $pl['battle'] . '"');
|
|
||||||
} else {
|
|
||||||
$txt = '<font color=red><b>Âíèìàíèå!</b></font><font color=darkgreen><b> Âñå ïîäçåìåëüÿ çàêðûòû ñ 22:00 äî 00:00! Ïîëó÷àåìûé îïûò íà Öåíòðàëüíîé ïëîùàäè +100%, â Õàîòè÷íûõ ïîåäèíêàõ, ïîáåäèòåëåé æäåò õîðîøàÿ íàãðàäà!';
|
|
||||||
mysql_query(
|
|
||||||
"INSERT INTO `chat` (`new`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`,`typeTime`) VALUES (1,'" . $pl['city'] . "','','','','" . $txt . "','" . time(
|
|
||||||
) . "','6','0','1')"
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,139 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
error_reporting(0);
|
|
||||||
ini_set('display_errors', 'Off');
|
|
||||||
|
|
||||||
const GAME = true;
|
|
||||||
|
|
||||||
setlocale(LC_CTYPE, "ru_RU.CP1251");
|
|
||||||
|
|
||||||
include('_incl_data/__config.php');
|
|
||||||
include('_incl_data/class/__db_connect.php');
|
|
||||||
|
|
||||||
function inuser_go_btl($id)
|
|
||||||
{
|
|
||||||
if (isset($id['id'])) {
|
|
||||||
echo '[go]';
|
|
||||||
echo file_get_contents(
|
|
||||||
'https://new-combats.com/jx/battle/refresh.php?uid=' . $id['id'] . '&cron_core=' . md5(
|
|
||||||
$id['id'] . '_brfCOreW@!_' . $id['pass']
|
|
||||||
) . '&pass=' . $id['pass']
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$ii = 0;
|
|
||||||
while ($ii < 6) {
|
|
||||||
$count = [0, 0, 0, 0, 0, 0];
|
|
||||||
$sp = mysql_query(
|
|
||||||
'SELECT `u`.* , `s`.* FROM `stats` AS `s` LEFT JOIN `users` AS `u` ON `u`.`id` = `s`.`id` WHERE `u`.`pass` = "saintlucia" OR `u`.`no_ip` = "trupojor" ORDER BY `s`.`nextAct` ASC LIMIT 100'
|
|
||||||
);
|
|
||||||
$btltest = [];
|
|
||||||
$btl_ref = [];
|
|
||||||
while ($pl = mysql_fetch_array($sp)) {
|
|
||||||
$i++;
|
|
||||||
if ($pl['zv'] > 0) {
|
|
||||||
$zv = mysql_fetch_array(
|
|
||||||
mysql_query(
|
|
||||||
'SELECT `id`,`time`,`razdel` FROM `zayvki` WHERE `id` = "' . $pl['zv'] . '" AND `btl_id` = 0 LIMIT 1'
|
|
||||||
)
|
|
||||||
);
|
|
||||||
if (!isset($zv['id']) || $zv['razdel'] != 5) {
|
|
||||||
$pl['zv'] = 0;
|
|
||||||
mysql_query('UPDATE `stats` SET `zv` = "0" WHERE `id` = "' . $pl['id'] . '" LIMIT 1');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ($pl['battle'] == -1) {
|
|
||||||
mysql_query('UPDATE `users` SET `battle` = 0,`ipreg` = 0 WHERE `id` = "' . $pl['id'] . '" LIMIT 1');
|
|
||||||
mysql_query('UPDATE `stats` SET `zv` = "0" WHERE `id` = "' . $pl['id'] . '" LIMIT 1');
|
|
||||||
$pl['battle'] = 0;
|
|
||||||
$pl['ipreg'] = 0;
|
|
||||||
}
|
|
||||||
if ((date('i') == 5 || date('i') == 6 || date('i') == 15 || date('i') == 16 || date('i') == 25 || date(
|
|
||||||
'i'
|
|
||||||
) == 26 || date('i') == 35 || date('i') == 36 || date('i') == 45) && $pl['zv'] == 0) {
|
|
||||||
mysql_query('UPDATE `users` SET `ipreg` = 0 WHERE `id` = "' . $pl['id'] . '" LIMIT 1');
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((!isset($btltest2[$pl['battle']]) || $btltest2[$pl['battle']] == 0) && $pl['battle'] > 0) {
|
|
||||||
$btltest2[$pl['battle']]++;
|
|
||||||
echo '<b>|' . $pl['battle'] . '|' . $pl['id'] . '|inBATTLE</b> | ';
|
|
||||||
inuser_go_btl($pl);
|
|
||||||
echo '{!}';
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($pl['zv'] == 0 && ($pl['battle'] == 0 || !isset($btltest[$pl['battle']]) || $btltest[$pl['battle']] < 1)) {
|
|
||||||
|
|
||||||
$btltest[$pl['battle']]++;
|
|
||||||
|
|
||||||
if ($pl['timereg'] == 0) {
|
|
||||||
mysql_query('UPDATE `users` SET `timereg` = "' . time() . '" WHERE `id` = "' . $pl['id'] . '" LIMIT 1');
|
|
||||||
} else {
|
|
||||||
mysql_query('UPDATE `users` SET `online` = "' . time() . '" WHERE `id` = "' . $pl['id'] . '" LIMIT 1');
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($pl['exp'] > 400000 && $pl['level'] == 8) {
|
|
||||||
$pl['exp'] = 400000;
|
|
||||||
mysql_query('UPDATE `stats` SET `exp` = "400000" WHERE `id` = "' . $pl['id'] . '" LIMIT 1');
|
|
||||||
} elseif ($pl['exp'] > 3500000 && $pl['level'] == 9) {
|
|
||||||
$pl['exp'] = 3500000;
|
|
||||||
mysql_query('UPDATE `stats` SET `exp` = "3500000" WHERE `id` = "' . $pl['id'] . '" LIMIT 1');
|
|
||||||
} elseif ($pl['exp'] > 48000000 && $pl['level'] == 10) {
|
|
||||||
$pl['exp'] = 48000000;
|
|
||||||
mysql_query('UPDATE `stats` SET `exp` = "48000000" WHERE `id` = "' . $pl['id'] . '" LIMIT 1');
|
|
||||||
} elseif ($pl['exp'] > 148000000 && $pl['level'] == 11) {
|
|
||||||
$pl['exp'] = 148000000;
|
|
||||||
mysql_query('UPDATE `stats` SET `exp` = "148000000" WHERE `id` = "' . $pl['id'] . '" LIMIT 1');
|
|
||||||
} elseif ($pl['exp'] > 400000000 && $pl['level'] == 12) {
|
|
||||||
$pl['exp'] = 400000000;
|
|
||||||
mysql_query('UPDATE `stats` SET `exp` = "400000000" WHERE `id` = "' . $pl['id'] . '" LIMIT 1');
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($pl['bot'] == 0) {
|
|
||||||
mysql_query('UPDATE `stats` SET `bot` = "2" WHERE `id` = "' . $pl['id'] . '" LIMIT 1');
|
|
||||||
}
|
|
||||||
|
|
||||||
mysql_query('UPDATE `stats` SET `nextAct` = "' . time() . '" WHERE `id` = "' . $pl['id'] . '" LIMIT 1');
|
|
||||||
mysql_query(
|
|
||||||
'UPDATE `users` SET `online` = "' . time() . '",`afk` = "" WHERE `id` = "' . $pl['id'] . '" LIMIT 1'
|
|
||||||
);
|
|
||||||
|
|
||||||
BotLogic::start($pl['id']);
|
|
||||||
|
|
||||||
} else {
|
|
||||||
if ($pl['timereg'] == 0) {
|
|
||||||
mysql_query('UPDATE `users` SET `timereg` = "' . time() . '" WHERE `id` = "' . $pl['id'] . '" LIMIT 1');
|
|
||||||
} else {
|
|
||||||
mysql_query('UPDATE `users` SET `online` = "' . time() . '" WHERE `id` = "' . $pl['id'] . '" LIMIT 1');
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($pl['exp'] > 400000 && $pl['level'] == 8) {
|
|
||||||
$pl['exp'] = 400000;
|
|
||||||
mysql_query('UPDATE `stats` SET `exp` = "400000" WHERE `id` = "' . $pl['id'] . '" LIMIT 1');
|
|
||||||
} elseif ($pl['exp'] > 3500000 && $pl['level'] == 9) {
|
|
||||||
$pl['exp'] = 3500000;
|
|
||||||
mysql_query('UPDATE `stats` SET `exp` = "3500000" WHERE `id` = "' . $pl['id'] . '" LIMIT 1');
|
|
||||||
} elseif ($pl['exp'] > 48000000 && $pl['level'] == 10) {
|
|
||||||
$pl['exp'] = 48000000;
|
|
||||||
mysql_query('UPDATE `stats` SET `exp` = "48000000" WHERE `id` = "' . $pl['id'] . '" LIMIT 1');
|
|
||||||
} elseif ($pl['exp'] > 148000000 && $pl['level'] == 11) {
|
|
||||||
$pl['exp'] = 148000000;
|
|
||||||
mysql_query('UPDATE `stats` SET `exp` = "148000000" WHERE `id` = "' . $pl['id'] . '" LIMIT 1');
|
|
||||||
} elseif ($pl['exp'] > 400000000 && $pl['level'] == 12) {
|
|
||||||
$pl['exp'] = 400000000;
|
|
||||||
mysql_query('UPDATE `stats` SET `exp` = "148000000" WHERE `id` = "' . $pl['id'] . '" LIMIT 1');
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($pl['bot'] == 0) {
|
|
||||||
mysql_query('UPDATE `stats` SET `bot` = "2" WHERE `id` = "' . $pl['id'] . '" LIMIT 1');
|
|
||||||
}
|
|
||||||
mysql_query('UPDATE `stats` SET `nextAct` = "' . time() . '" WHERE `id` = "' . $pl['id'] . '" LIMIT 1');
|
|
||||||
mysql_query('UPDATE `users` SET `online` = "' . time() . '" WHERE `id` = "' . $pl['id'] . '" LIMIT 1');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$ii++;
|
|
||||||
echo 'TEST:' . $ii;
|
|
||||||
unset($btltest, $btl_ref, $btltest2);
|
|
||||||
sleep(4);
|
|
||||||
}
|
|
87
cron_bs.php
87
cron_bs.php
@ -1,87 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
|
|
||||||
die('×òî-òî òóò íå òàê...');
|
|
||||||
|
|
||||||
function getIP() {
|
|
||||||
if(isset($_SERVER['HTTP_X_REAL_IP'])) return $_SERVER['HTTP_X_REAL_IP'];
|
|
||||||
return $_SERVER['REMOTE_ADDR'];
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if( $_SERVER['HTTP_CF_CONNECTING_IP'] != $_SERVER['SERVER_ADDR'] && $_SERVER['HTTP_CF_CONNECTING_IP'] != '127.0.0.1' ) { die('Hello pussy!'); }
|
|
||||||
|
|
||||||
# Ïîëó÷àåì IP
|
|
||||||
function getIPblock() {
|
|
||||||
if(isset($_SERVER['HTTP_X_REAL_IP'])) return $_SERVER['HTTP_X_REAL_IP'];
|
|
||||||
return $_SERVER['REMOTE_ADDR'];
|
|
||||||
}
|
|
||||||
|
|
||||||
# Âûïîëíÿåì ïðîâåðêó áåçîïàñíîñòè.
|
|
||||||
|
|
||||||
if( $_SERVER['HTTP_CF_CONNECTING_IP'] != $_SERVER['SERVER_ADDR'] && $_SERVER['HTTP_CF_CONNECTING_IP'] != '127.0.0.1' ) { die('Hello pussy!'); }
|
|
||||||
if(getIPblock() != $_SERVER['SERVER_ADDR'] && getIPblock() != '127.0.0.1' && getIPblock() != '' && getIPblock() != '5.187.7.71') {
|
|
||||||
die(getIPblock().'<br>'.$_SERVER['SERVER_ADDR']);
|
|
||||||
}
|
|
||||||
|
|
||||||
define('GAME',true);
|
|
||||||
setlocale(LC_CTYPE ,"ru_RU.CP1251");
|
|
||||||
require_once('_incl_data/__config.php');
|
|
||||||
require_once('_incl_data/class/__db_connect.php');
|
|
||||||
//require_once('_incl_data/class/__user.php');
|
|
||||||
|
|
||||||
function send($text) {
|
|
||||||
return mysql_query('INSERT INTO `chat` (`new`,`type`,`to`,`text`,`time`) VALUES (1,6,"Èãðîìèð","'.$text.'",'.time().')');
|
|
||||||
}
|
|
||||||
|
|
||||||
$i = 7;
|
|
||||||
while($i <= 11) {
|
|
||||||
$t = mysql_fetch_array(mysql_query('SELECT * FROM `bs_turnirs` WHERE `city` = "capitalcity" AND `level` = "'.$i.'" LIMIT 1'));
|
|
||||||
if(isset($t['id'])) {
|
|
||||||
//send('Òóðíèð ['.$i.'] - status'.$t['status'].'');
|
|
||||||
if($t['status'] == 1) {
|
|
||||||
//Òóðíèð èäåò ñåé÷àñ
|
|
||||||
$users = mysql_fetch_array(mysql_query('SELECT COUNT(*) FROM `users` WHERE `room` = "264" AND `login` NOT LIKE "%êëîí%" AND `lose` = "0" AND `nich` = "0" LIMIT 1'));
|
|
||||||
if($users[0] < 2) {
|
|
||||||
//Òóðíèð çàâåðøèëñÿ
|
|
||||||
//çàâåðøàåì òóðíèð
|
|
||||||
mysql_query('UPDATE `bs_turnirs` SET `status` = "0",`users_finish` = "0",`money` = "0",`time_start` = "'.(time()+$t['time_out']*60).'",`users` = "0" WHERE `id` = "'.$t['id'].'" LIMIT 1');
|
|
||||||
|
|
||||||
//óäàëÿåì áîòîâ â êîòîðûõ âñåëèëèñü
|
|
||||||
$sp = mysql_query('SELECT * FROM `bs_zv` WHERE `bsid` = "'.$t['id'].'" AND `time` = "'.$t['time_start'].'" AND `finish` = "0" ORDER BY `money` DESC LIMIT 100');
|
|
||||||
while($pl = mysql_fetch_array($sp))
|
|
||||||
{
|
|
||||||
$ur = mysql_fetch_array(mysql_query('SELECT `id`,`login`,`room`,`name`,`sex`,`inUser` FROM `users` WHERE `id` = "'.$pl['uid'].'" LIMIT 1'));
|
|
||||||
if(isset($ur['id']))
|
|
||||||
{
|
|
||||||
//del
|
|
||||||
mysql_query('DELETE FROM `users` WHERE `id` = "'.$ur['inUser'].'" LIMIT 1');
|
|
||||||
mysql_query('DELETE FROM `stats` WHERE `id` = "'.$ur['inUser'].'" LIMIT 1');
|
|
||||||
mysql_query('DELETE FROM `items_users` WHERE `uid` = "'.$ur['inUser'].'" LIMIT 1');
|
|
||||||
mysql_query('DELETE FROM `eff_users` WHERE `uid` = "'.$ur['inUser'].'" LIMIT 1');
|
|
||||||
//upd
|
|
||||||
mysql_query('UPDATE `bs_zv` SET `finish` = "'.time().'" WHERE `id` = "'.$pl['id'].'" LIMIT 1');
|
|
||||||
mysql_query('UPDATE `users` SET `inUser` = "0" WHERE `id` = "'.$pl['uid'].'" LIMIT 1');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
mysql_query('DELETE FROM `dungeon_now` WHERE `bsid` = "'.$t['inUser'].'" AND `time_start` = "'.$t['time_start'].'" LIMIT 1');
|
|
||||||
//Âèçóàëüíûå îáíîâëåíèÿ
|
|
||||||
unset($tz);
|
|
||||||
$t['status'] = 0;
|
|
||||||
$t['money'] = 0;
|
|
||||||
$t['users'] = 0;
|
|
||||||
$t['time_start'] = (time()+$t['time_out']*60);
|
|
||||||
send('Òóðíèð ['.$i.'] - '.$users[0].' - Òóðíèð çàâåðøèëñÿ');
|
|
||||||
}else{
|
|
||||||
//Òóðíèð åùå èäåò
|
|
||||||
|
|
||||||
}
|
|
||||||
}else{
|
|
||||||
//Îæèäàåì íà÷àëà òóðíèðà
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$i++;
|
|
||||||
}
|
|
||||||
?>
|
|
@ -1,4 +0,0 @@
|
|||||||
<?php
|
|
||||||
//include_once '/cron_dungeon_getOut.php'; // Åñëè èãðîê â ïîäçåìåëüè è íå â ñåòè 9 ÷àñîâ è áîëåå, âûêèäûâàåì åãî èç ïîäçåìåëüÿ.
|
|
||||||
//include_once '/cron_dungeon_goBots.php'; // Áîòû õîäÿò êàæäûå 5 ñåêóíä ïî òàéìàóòó.
|
|
||||||
?>
|
|
@ -1,113 +0,0 @@
|
|||||||
<?php
|
|
||||||
# Ñêðèïò îòâå÷àåò çà
|
|
||||||
# ÷èñòêó ïåùåð êîòîðûå íå èñïîëüçóþòñÿ èãðîêîì â òå÷åíèè 3 ÷àñîâ
|
|
||||||
# ïðè ó÷åòå ÷òî ïåùåðå áîëüøå 5 ÷àñîâ îò âðåìåíè ñîçäàíèÿ.
|
|
||||||
|
|
||||||
# Ïîëó÷àåì IP
|
|
||||||
function getIPblock() {
|
|
||||||
if(isset($_SERVER['HTTP_X_REAL_IP'])) return $_SERVER['HTTP_X_REAL_IP'];
|
|
||||||
return $_SERVER['REMOTE_ADDR'];
|
|
||||||
}
|
|
||||||
|
|
||||||
# Âûïîëíÿåì ïðîâåðêó áåçîïàñíîñòè.
|
|
||||||
|
|
||||||
/*if(!isset($_GET['test'])) {
|
|
||||||
if( $_SERVER['HTTP_CF_CONNECTING_IP'] != $_SERVER['SERVER_ADDR'] && $_SERVER['HTTP_CF_CONNECTING_IP'] != '127.0.0.1' && getIPblock() != '5.187.7.71' ) { die('Hello pussy!'); }
|
|
||||||
if(getIPblock() != $_SERVER['SERVER_ADDR'] && getIPblock() != '127.0.0.1' && getIPblock() != '' && getIPblock() != '5.187.7.71') {
|
|
||||||
die(getIPblock().'<br>'.$_SERVER['SERVER_ADDR']);
|
|
||||||
}
|
|
||||||
}*/
|
|
||||||
|
|
||||||
|
|
||||||
define('GAME', true);
|
|
||||||
setlocale(LC_CTYPE ,"ru_RU.CP1251");
|
|
||||||
|
|
||||||
require_once('_incl_data/__config.php');
|
|
||||||
require_once('_incl_data/class/__db_connect.php');
|
|
||||||
//require_once('_incl_data/class/__user.php');
|
|
||||||
//require_once('_incl_data/class/__dungeon.php');
|
|
||||||
|
|
||||||
# çàïóñê ñêðèïòà.
|
|
||||||
function start() {
|
|
||||||
# Ñòðàíèöà ñîçäàíà 0.0000
|
|
||||||
$mtime = microtime();$mtime = explode(" ",$mtime);$tstart = $mtime[1] + $mtime[0];
|
|
||||||
|
|
||||||
# Âûáèðàåì âñåõ áîòîâ.
|
|
||||||
#  âûáîðêó âêëþ÷åíî: Ïîçèöèÿ áîòà, Íàïðàâëåíèå êóäà îí ìîæåò èäòè, Ñóùåñòâóåò ëè ðÿäîì Èãðîê, åãî êîîðäèíàòû è â ïîåäèíêå ëè îí.
|
|
||||||
$query = mysql_query(
|
|
||||||
"SELECT
|
|
||||||
`dn`.time_start as dn_start,
|
|
||||||
`dn`.city as city,
|
|
||||||
`dn`.id as dn_id,
|
|
||||||
`uc`.countUsers as u_count
|
|
||||||
FROM `dungeon_now` as `dn`
|
|
||||||
LEFT JOIN `stats` as `st` ON `st`.id = `dn`.uid
|
|
||||||
LEFT JOIN `users` as `u` ON `u`.id = `dn`.uid
|
|
||||||
LEFT JOIN (SELECT dnow, count(id) as countUsers FROM `stats` group by dnow ) as `uc` ON `uc`.dnow = `dn`.id
|
|
||||||
|
|
||||||
WHERE
|
|
||||||
`st`.dnow > 0 AND
|
|
||||||
`st`.dnow != '' AND
|
|
||||||
`u`.online < ".(time()-10800)." AND
|
|
||||||
`dn`.time_start < ".(time()-18000)." AND
|
|
||||||
`dn`.time_finish = '0' AND `dn`.`bsid` = '0'
|
|
||||||
GROUP BY `dn`.id
|
|
||||||
ORDER BY `dn`.id DESC;"
|
|
||||||
);
|
|
||||||
|
|
||||||
while( $dungeon = mysql_fetch_array( $query ) ) {
|
|
||||||
if(isset($dungeon['dn_id']) && $dungeon['dn_id'] != 15) {
|
|
||||||
# [1] Âûêèäûâàåì èãðîêîâ ñ ïîäçåìåëüÿ è ïåðåìåùàåì åãî `382` Ïîäâàëüíîå ïîìåùåíèå(Ìàã.ïîðòàëà)
|
|
||||||
$users = mysql_query('SELECT `id` FROM `stats` WHERE `dnow` = "'.$dungeon['dn_id'].'" LIMIT 10');
|
|
||||||
while( $cur = mysql_fetch_array($users) ) {
|
|
||||||
mysql_query('UPDATE `stats` SET `dnow` = "0" WHERE `id` = "'.$cur['id'].'" LIMIT 1');
|
|
||||||
//
|
|
||||||
$podval_room = 382;
|
|
||||||
//
|
|
||||||
print_r($dungeon);
|
|
||||||
if( $dungeon['city'] == 'capitalcity' ) {
|
|
||||||
//$podval_room = 372;
|
|
||||||
$podval_room = 321;
|
|
||||||
}elseif( $dungeon['city'] == 'angelscity' ) {
|
|
||||||
$podval_room = 242;
|
|
||||||
}
|
|
||||||
|
|
||||||
mysql_query('UPDATE `users` SET `room` = "'.$podval_room.'" WHERE `id` = "'.$cur['id'].'" LIMIT 1');
|
|
||||||
#echo 'Âûáðîñèëè èãðîêà ¹'.$cur['id'].' ñ ïîäçåìåëüÿ '.$dungeon['dn_id'].' è ïåðåìåñòèëè â <strong>Ïîäâàëüíîå ïîìåùåíèå</strong><br/>';
|
|
||||||
mysql_query('UPDATE `items_users` SET `delete` = "'.time().'" WHERE `uid` = "'.$cur['id'].'" AND `dn_delete` = "1"');
|
|
||||||
# echo 'Âûáðàñûâàåì ïåùåðíûå ïðåäìåòû ó èãðîêà ¹'.$cur['id'].' <br/>';
|
|
||||||
}
|
|
||||||
unset( $cur );
|
|
||||||
# [2] Óäàëÿåì Îáúåêòû.
|
|
||||||
mysql_query('DELETE FROM `dungeon_obj` WHERE `dn` = "'.$dungeon['dn_id'].'" AND `for_dn` = "0"');
|
|
||||||
# echo 'Óäàëÿåì îáúåêòû â ïåùåðå ¹'.$dungeon['dn_id'].'<br/>';
|
|
||||||
|
|
||||||
# [3] Óäàëÿåì Ìîíñòðîâ.
|
|
||||||
mysql_query('DELETE FROM `dungeon_bots` WHERE `dn` = "'.$dungeon['dn_id'].'" AND `for_dn` = "0"');
|
|
||||||
# echo 'Óäàëÿåì ìîíñòðîâ â ïåùåðå ¹'.$dungeon['dn_id'].'<br/>';
|
|
||||||
|
|
||||||
# [4] Óäàëÿåì Ïðåäìåòû.
|
|
||||||
mysql_query('DELETE FROM `dungeon_items` WHERE `dn` = "'.$dungeon['dn_id'].'" AND `for_dn` = "0"');
|
|
||||||
# echo 'Óäàëÿåì ïðåäìåòû â ïåùåðå ¹'.$dungeon['dn_id'].'<br/>';
|
|
||||||
|
|
||||||
# [5] Óäàëÿåì Äåéñòâèÿ (actions)
|
|
||||||
mysql_query('DELETE FROM `dungeon_actions` WHERE `dn` = "'.$dungeon['dn_id'].'"');
|
|
||||||
# echo 'Óäàëÿåì äåéñòâèÿ â ïåùåðå ¹'.$dungeon['dn_id'].'<br/>';
|
|
||||||
|
|
||||||
# [6] Çàêðûâàåì Ïîäçåìåëüå Dungeon_Now - time_finish = time();
|
|
||||||
mysql_query('UPDATE `dungeon_now` SET `time_finish` = "'.time().'" WHERE `id` = "'.$dungeon['dn_id'].'" LIMIT 1');
|
|
||||||
|
|
||||||
echo 'Çàêðûëè ïåùåðó ¹'.$dungeon['dn_id'].'<br/><br/>';
|
|
||||||
} else {
|
|
||||||
echo 'Íåò äàííûõ äëÿ îáðàáîòêè.<br/><br/>';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
unset($query,$dungeon,$users);
|
|
||||||
|
|
||||||
$mtime = microtime();
|
|
||||||
$mtime = explode(" ",$mtime);$mtime = $mtime[1] + $mtime[0];$totaltime = ($mtime - $tstart);
|
|
||||||
printf ("Ñòðàíèöà ñãåíåðèðîâàíà çà %f ñåêóíä !", $totaltime);
|
|
||||||
}
|
|
||||||
|
|
||||||
# Çàïóñêàåì âûïîëíåíèå ïðîöåññà.
|
|
||||||
start();
|
|
@ -1,19 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
const GAME = true;
|
|
||||||
|
|
||||||
include('_incl_data/__config.php');
|
|
||||||
include('_incl_data/class/__db_connect.php');
|
|
||||||
|
|
||||||
$sp = mysql_query(
|
|
||||||
'SELECT `u`.*,`s`.*,`u`.`id`,`s`.`id` FROM `users` AS `u` LEFT JOIN `stats` AS `s` ON ( `s`.`id` = `u`.`id` AND `s`.`bot` = 0 ) WHERE `login` = "Crowley"'
|
|
||||||
);
|
|
||||||
while ($pl = mysql_fetch_array($sp)) {
|
|
||||||
$last_dnow = mysql_fetch_array(mysql_query('SELECT * FROM `save_dungeon` WHERE `uid` = "' . $pl['id'] . '"'));
|
|
||||||
if (isset($last_dnow['id'])) {
|
|
||||||
mysql_query('UPDATE `users` SET `room` = "405" WHERE `id` = "' . $last_dnow['uid'] . '"');
|
|
||||||
mysql_query(
|
|
||||||
'UPDATE `stats` SET `dnow` = "' . $last_dnow['dnow'] . '",`x` = "' . $last_dnow['x'] . '",`y` = "' . $last_dnow['y'] . '" WHERE `id` = "' . $last_dnow['uid'] . '"'
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
78
cron_h.php
78
cron_h.php
@ -1,78 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
die('×òî-òî òóò íå òàê...');
|
|
||||||
|
|
||||||
function getIP() {
|
|
||||||
if(isset($_SERVER['HTTP_X_REAL_IP'])) return $_SERVER['HTTP_X_REAL_IP'];
|
|
||||||
return $_SERVER['REMOTE_ADDR'];
|
|
||||||
}
|
|
||||||
|
|
||||||
# Ïîëó÷àåì IP
|
|
||||||
function getIPblock() {
|
|
||||||
if(isset($_SERVER['HTTP_X_REAL_IP'])) return $_SERVER['HTTP_X_REAL_IP'];
|
|
||||||
return $_SERVER['REMOTE_ADDR'];
|
|
||||||
}
|
|
||||||
|
|
||||||
# Âûïîëíÿåì ïðîâåðêó áåçîïàñíîñòè.
|
|
||||||
|
|
||||||
if( $_SERVER['HTTP_CF_CONNECTING_IP'] != $_SERVER['SERVER_ADDR'] && $_SERVER['HTTP_CF_CONNECTING_IP'] != '127.0.0.1' ) { die('Hello pussy!'); }
|
|
||||||
if(getIPblock() != $_SERVER['SERVER_ADDR'] && getIPblock() != '127.0.0.1' && getIPblock() != '' && getIPblock() != '5.187.7.71') {
|
|
||||||
die(getIPblock().'<br>'.$_SERVER['SERVER_ADDR']);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
define('GAME',true);
|
|
||||||
|
|
||||||
require_once('_incl_data/__config.php');
|
|
||||||
require_once('_incl_data/class/__db_connect.php');
|
|
||||||
|
|
||||||
function e($t) {
|
|
||||||
mysql_query('INSERT INTO `chat` (`text`,`city`,`to`,`type`,`new`,`time`) VALUES ("core #'.date('d.m.Y').' %'.date('H:i:s').' (Êðèòè÷åñêàÿ îøèáêà): <b>'.mysql_real_escape_string($t).'</b>","capitalcity","ENERGY STAR","6","1","-1")');
|
|
||||||
}
|
|
||||||
|
|
||||||
function send_chat($type,$from,$text,$time) {
|
|
||||||
mysql_query('INSERT INTO `chat` (`text`,`city`,`login`,`to`,`type`,`new`,`time`,`room`) VALUES ("'.mysql_real_escape_string($text).'","capitalcity","'.mysql_real_escape_string($from).'","","'.$type.'","1","'.mysql_real_escape_string($time).'","3")');
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* Áàáà ìàíÿ */
|
|
||||||
function many_start() {
|
|
||||||
$qtext = '';
|
|
||||||
$atext = '';
|
|
||||||
$msec = 120;
|
|
||||||
$lmvc = array();
|
|
||||||
$lmv = mysql_query('SELECT `id` FROM `aaa_many` WHERE `time` < "'.(time()-86400).'" ORDER BY `time` ASC');
|
|
||||||
while( $plmv = mysql_fetch_array($lmv) ) {
|
|
||||||
$lmvc[] = $plmv['id'];
|
|
||||||
}
|
|
||||||
$lmvc = $lmvc[rand(0,(count($lmvc)-1))];
|
|
||||||
$lmv = mysql_fetch_array(mysql_query('SELECT * FROM `aaa_many` WHERE `id` = "'.$lmvc.'" LIMIT 1'));
|
|
||||||
if( isset($lmv['id']) ) {
|
|
||||||
$qtext = $lmv['text'];
|
|
||||||
$atext = $lmv['answer'];
|
|
||||||
mysql_query('UPDATE `aaa_many` SET `time` = "'.time().'" WHERE `id` = "'.$lmv['id'].'" LIMIT 1');
|
|
||||||
}
|
|
||||||
if( $qtext != '' ) {
|
|
||||||
$qtext = str_replace('"','"',$qtext);
|
|
||||||
$qtext = str_replace("'",'"',$qtext);
|
|
||||||
$qtext = str_replace('<','<',$qtext);
|
|
||||||
$qtext = str_replace('>','>',$qtext);
|
|
||||||
$qtext = str_replace('
|
|
||||||
',' ',$qtext);
|
|
||||||
$qtext = str_replace("\r",' ',$qtext);
|
|
||||||
$qtext = str_replace('ñ','c',$qtext);
|
|
||||||
$qtext = str_replace('õ','x',$qtext);
|
|
||||||
$qtext = str_replace('ó','y',$qtext);
|
|
||||||
$qtext = str_replace('å','e',$qtext);
|
|
||||||
$qtext = str_replace('î','o',$qtext);
|
|
||||||
$qtext = str_replace('ð','p',$qtext);
|
|
||||||
$qtext = str_replace('è','u',$qtext);
|
|
||||||
mysql_query('UPDATE `users` SET `online` = "'.time().'" WHERE `id` = 1003553 LIMIT 1');
|
|
||||||
send_chat(1,'Áàáà Ìàíÿ','<font color=#cb0000><b>Âíèìàíèå!</b> Ïðîâîäèòñÿ âèêòîðèíà! Ïåðâîìó, êòî ïðàâèëüíî îòâåòèò íà ñëåäóþùèé âîïðîñ áóäåò âûïëà÷åí äåíåæíûé ïðèç. Âðåìÿ îæèäàíèÿ îòâåòà '.$msec.' ñåêóíä. Âàøè îòâåòû ïèøèòå â ÷àò <b>to [Áàáà Ìàíÿ]</b>. Âíèìàíèå, âîïðîñ: <b>'.$qtext.'</b></font>',time());
|
|
||||||
mysql_query('INSERT INTO `aaa_many_now` (`qid`,`time`) VALUES ("'.$lmv['id'].'","'.(time()+$msec).'")');
|
|
||||||
send_chat(1,'Áàáà Ìàíÿ','<font color=red>Íèêòî íå óãàäàë! Ïðàâèëüíûé îòâåò: <b>'.$atext.'</b></font>.',-(time()+$msec));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
many_start();
|
|
||||||
?>
|
|
@ -1,223 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
die('×òî-òî òóò íå òàê...');
|
|
||||||
|
|
||||||
function getIP()
|
|
||||||
{
|
|
||||||
return getIPblock();
|
|
||||||
}
|
|
||||||
|
|
||||||
# Ïîëó÷àåì IP
|
|
||||||
function getIPblock()
|
|
||||||
{
|
|
||||||
return isset($_SERVER['HTTP_X_REAL_IP']) ? $_SERVER['HTTP_X_REAL_IP'] : $_SERVER['REMOTE_ADDR'];
|
|
||||||
}
|
|
||||||
|
|
||||||
# Âûïîëíÿåì ïðîâåðêó áåçîïàñíîñòè.
|
|
||||||
|
|
||||||
if ($_SERVER['HTTP_CF_CONNECTING_IP'] != $_SERVER['SERVER_ADDR'] && $_SERVER['HTTP_CF_CONNECTING_IP'] != '127.0.0.1') {
|
|
||||||
die('Hello pussy!');
|
|
||||||
}
|
|
||||||
if (getIPblock() != $_SERVER['SERVER_ADDR'] && getIPblock() != '127.0.0.1' && getIPblock() != '' && getIPblock(
|
|
||||||
) != '5.187.7.71') {
|
|
||||||
die(getIPblock() . '<br>' . $_SERVER['SERVER_ADDR']);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
const GAME = true;
|
|
||||||
|
|
||||||
include('_incl_data/__config.php');
|
|
||||||
include('_incl_data/class/__db_connect.php');
|
|
||||||
|
|
||||||
function e($t)
|
|
||||||
{
|
|
||||||
mysql_query(
|
|
||||||
'INSERT INTO `chat` (`text`,`city`,`to`,`type`,`new`,`time`) VALUES ("core #' . date('d.m.Y') . ' %' . date(
|
|
||||||
'H:i:s'
|
|
||||||
) . ' (Êðèòè÷åñêàÿ îøèáêà): <b>' . mysql_real_escape_string($t) . '</b>","capitalcity","LEL","6","1","-1")'
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
function send_chat($type, $from, $text, $time)
|
|
||||||
{
|
|
||||||
mysql_query(
|
|
||||||
'INSERT INTO `chat` (`text`,`city`,`login`,`to`,`type`,`new`,`time`,`room`) VALUES ("' . mysql_real_escape_string(
|
|
||||||
$text
|
|
||||||
) . '","capitalcity","' . mysql_real_escape_string(
|
|
||||||
$from
|
|
||||||
) . '","","' . $type . '","1","' . mysql_real_escape_string($time) . '","3")'
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
$kp = [
|
|
||||||
0 => 1,
|
|
||||||
1 => 1,
|
|
||||||
2 => 3,
|
|
||||||
3 => 3,
|
|
||||||
4 => 3,
|
|
||||||
5 => 7,
|
|
||||||
6 => 7,
|
|
||||||
7 => 7,
|
|
||||||
8 => 90,
|
|
||||||
9 => 90,
|
|
||||||
10 => 90,
|
|
||||||
11 => 90,
|
|
||||||
12 => 90,
|
|
||||||
13 => 90,
|
|
||||||
14 => 90,
|
|
||||||
15 => 90,
|
|
||||||
16 => 90,
|
|
||||||
17 => 90,
|
|
||||||
18 => 90,
|
|
||||||
19 => 90,
|
|
||||||
20 => 90,
|
|
||||||
21 => 90,
|
|
||||||
];
|
|
||||||
|
|
||||||
function addUser($userData)
|
|
||||||
{
|
|
||||||
$query = "INSERT INTO `users_kill` ( " .
|
|
||||||
mysql_real_escape_string(implode(' , ', array_keys($userData))) .
|
|
||||||
" ) VALUES ( '" .
|
|
||||||
(implode("' , '", $userData)) .
|
|
||||||
"' )";
|
|
||||||
|
|
||||||
return $query;
|
|
||||||
}
|
|
||||||
|
|
||||||
//Óäàëÿåì ýôôåêòû è ïðåäìåòû (íå íóæíûå)
|
|
||||||
mysql_query('DELETE FROM `eff_users` WHERE `delete` > "1392211522" AND `delete` < "' . time() . '"');
|
|
||||||
mysql_query('DELETE FROM `items_users` WHERE `delete` > "1392211522" AND `delete` < "' . time() . '"');
|
|
||||||
|
|
||||||
$lvl = 0;
|
|
||||||
while ($lvl <= 21) {
|
|
||||||
$last_time = round(time() - (2 * $kp[$lvl] * 86400));
|
|
||||||
$sp = mysql_query(
|
|
||||||
'SELECT `u`.*,`s`.*,`u`.`id` AS `id1`,`s`.`id` AS `id2` FROM `users` AS `u` LEFT JOIN `stats` AS `s` ON ( `s`.`id` = `u`.`id` AND `s`.`bot` = 0 ) WHERE `u`.`admin` = 0 AND `u`.`pass` != "" AND `u`.`no_ip` = "" AND `u`.`level` = "' . $lvl . '" AND `align` != 50 AND `u`.`online` < ' . $last_time . ' LIMIT 1000'
|
|
||||||
);
|
|
||||||
while ($pl = mysql_fetch_array($sp)) {
|
|
||||||
|
|
||||||
if ($pl['id'] < 1) {
|
|
||||||
if ($pl['id1'] > 0) {
|
|
||||||
$pl['id'] = $pl['id1'];
|
|
||||||
} elseif ($pl['id2'] > 0) {
|
|
||||||
$pl['id'] = $pl['id2'];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//Ñîáèðàåì äàííûå ñêîëüêî öåííîñòåé áûëî íà ïåðñîíàæå
|
|
||||||
$pl['bank'] = mysql_fetch_array(
|
|
||||||
mysql_query('SELECT SUM(`money1`),SUM(`money2`) FROM `bank` WHERE `uid` = "' . $pl['id'] . '" LIMIT 1')
|
|
||||||
);
|
|
||||||
$pl['money'] += $pl['bank'][0];
|
|
||||||
$pl['money2'] += $pl['bank'][1];
|
|
||||||
$sitm = mysql_query(
|
|
||||||
'SELECT `id`,`item_id`,`1price`,`2price` FROM `items_users` WHERE (`delete` = 1000 OR `delete` = 0) AND `delete` = "0" AND `data` NOT LIKE "%|frompisher=%" AND `uid` = "' . $pl['id'] . '"'
|
|
||||||
);
|
|
||||||
while ($pitm = mysql_fetch_array($sitm)) {
|
|
||||||
if ($pitm['1price'] != 0) {
|
|
||||||
$pl['money'] += $pitm['1price'];
|
|
||||||
} elseif ($pitm['2price'] != 0) {
|
|
||||||
$pl['money'] += $pitm['2price'];
|
|
||||||
} else {
|
|
||||||
$pitems = mysql_fetch_array(
|
|
||||||
mysql_query(
|
|
||||||
'SELECT `price1`,`price2` FROM `items_main` WHERE `id` = "' . $sitm['item_id'] . '" LIMIT 1'
|
|
||||||
)
|
|
||||||
);
|
|
||||||
if ($pitems['price2'] > 0) {
|
|
||||||
$pl['money'] += $pitems['price2'];
|
|
||||||
} else {
|
|
||||||
$pl['money2'] += $pitems['price1'];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ($pl['id'] > 0) {
|
|
||||||
//Óäàëÿåì âñå äàííûå î ïåðñîíàæå íà ïðîåêòå
|
|
||||||
mysql_query('DELETE FROM `aaa_znahar` WHERE `uid` = "' . $pl['id'] . '"');
|
|
||||||
mysql_query('DELETE FROM `actions` WHERE `uid` = "' . $pl['id'] . '"');
|
|
||||||
mysql_query('DELETE FROM `add_smiles` WHERE `uid` = "' . $pl['id'] . '"');
|
|
||||||
mysql_query('DELETE FROM `a_com_act` WHERE `uid` = "' . $pl['id'] . '"');
|
|
||||||
mysql_query('DELETE FROM `a_noob` WHERE `uid` = "' . $pl['id'] . '"');
|
|
||||||
mysql_query('DELETE FROM `a_system` WHERE `uid` = "' . $pl['id'] . '"');
|
|
||||||
mysql_query('DELETE FROM `a_vaucher` WHERE `uid` = "' . $pl['id'] . '"');
|
|
||||||
mysql_query('DELETE FROM `a_vaucher_active` WHERE `uid` = "' . $pl['id'] . '"');
|
|
||||||
mysql_query('DELETE FROM `bank` WHERE `uid` = "' . $pl['id'] . '"');
|
|
||||||
mysql_query('DELETE FROM `bank_alh` WHERE `uid` = "' . $pl['id'] . '"');
|
|
||||||
mysql_query('DELETE FROM `battle_actions` WHERE `uid` = "' . $pl['id'] . '"');
|
|
||||||
mysql_query('DELETE FROM `battle_cache` WHERE `uid` = "' . $pl['id'] . '"');
|
|
||||||
mysql_query('DELETE FROM `bid` WHERE `uid` = "' . $pl['id'] . '"');
|
|
||||||
mysql_query('DELETE FROM `bs_actions` WHERE `uid` = "' . $pl['id'] . '"');
|
|
||||||
mysql_query('DELETE FROM `bs_zv` WHERE `uid` = "' . $pl['id'] . '"');
|
|
||||||
mysql_query('DELETE FROM `complects_priem` WHERE `uid` = "' . $pl['id'] . '"');
|
|
||||||
mysql_query('DELETE FROM `dump` WHERE `uid` = "' . $pl['id'] . '"');
|
|
||||||
mysql_query('DELETE FROM `dungeon_actions` WHERE `uid` = "' . $pl['id'] . '"');
|
|
||||||
mysql_query('DELETE FROM `dungeon_now` WHERE `uid` = "' . $pl['id'] . '"');
|
|
||||||
mysql_query('DELETE FROM `dungeon_zv` WHERE `uid` = "' . $pl['id'] . '"');
|
|
||||||
mysql_query('DELETE FROM `eff_users` WHERE `uid` = "' . $pl['id'] . '"');
|
|
||||||
mysql_query('DELETE FROM `feerverks` WHERE `uid` = "' . $pl['id'] . '"');
|
|
||||||
mysql_query('DELETE FROM `fontan` WHERE `uid` = "' . $pl['id'] . '"');
|
|
||||||
mysql_query('DELETE FROM `fontan_hp` WHERE `uid` = "' . $pl['id'] . '"');
|
|
||||||
mysql_query(
|
|
||||||
'DELETE FROM `friends` WHERE `user` = "' . $pl['id'] . '" OR `friend` = "' . $pl['id'] . '" OR `enemy` = "' . $pl['id'] . '" OR `notinlist` = "' . $pl['id'] . '"'
|
|
||||||
);
|
|
||||||
mysql_query('DELETE FROM `house` WHERE `owner` = "' . $pl['id'] . '"');
|
|
||||||
mysql_query('DELETE FROM `items_img` WHERE `uid` = "' . $pl['id'] . '"');
|
|
||||||
mysql_query('DELETE FROM `items_users` WHERE `uid` = "' . $pl['id'] . '"');
|
|
||||||
mysql_query('DELETE FROM `izlom_rating` WHERE `uid` = "' . $pl['id'] . '"');
|
|
||||||
//mysql_query('DELETE FROM `obraz` WHERE `uid` = "'.$pl['id'].'"');
|
|
||||||
mysql_query('DELETE FROM `online` WHERE `uid` = "' . $pl['id'] . '"');
|
|
||||||
mysql_query('DELETE FROM `post` WHERE `uid` = "' . $pl['id'] . '"');
|
|
||||||
mysql_query('DELETE FROM `reimage` WHERE `uid` = "' . $pl['id'] . '"');
|
|
||||||
mysql_query('DELETE FROM `rep` WHERE `id` = "' . $pl['id'] . '"');
|
|
||||||
mysql_query('DELETE FROM `repass` WHERE `uid` = "' . $pl['id'] . '"');
|
|
||||||
mysql_query('DELETE FROM `ruletka_coin` WHERE `uid` = "' . $pl['id'] . '"');
|
|
||||||
mysql_query('DELETE FROM `save_com` WHERE `uid` = "' . $pl['id'] . '"');
|
|
||||||
mysql_query('DELETE FROM `stats` WHERE `id` = "' . $pl['id'] . '"');
|
|
||||||
mysql_query('DELETE FROM `telegram` WHERE `uid` = "' . $pl['id'] . '"');
|
|
||||||
mysql_query('DELETE FROM `transfers` WHERE `uid1` = "' . $pl['id'] . '" OR `uid2` = "' . $pl['id'] . '"');
|
|
||||||
mysql_query('DELETE FROM `users` WHERE `id` = "' . $pl['id'] . '"');
|
|
||||||
mysql_query('DELETE FROM `users_animal` WHERE `uid` = "' . $pl['id'] . '"');
|
|
||||||
//mysql_query('DELETE FROM `users_delo` WHERE `uid` = "'.$pl['id'].'"');
|
|
||||||
mysql_query('DELETE FROM `users_ico` WHERE `uid` = "' . $pl['id'] . '"');
|
|
||||||
mysql_query('DELETE FROM `users_turnirs` WHERE `uid` = "' . $pl['id'] . '"');
|
|
||||||
mysql_query('DELETE FROM `zayvki` WHERE `uid` = "' . $pl['id'] . '"');
|
|
||||||
mysql_query('DELETE FROM `_clan` WHERE `uid` = "' . $pl['id'] . '"');
|
|
||||||
echo '•' . $pl['login'] . '<br>';
|
|
||||||
}
|
|
||||||
|
|
||||||
//Çàíîñèì äàííûå â áàçó
|
|
||||||
$usrData = [
|
|
||||||
'`uid`' => $pl['id'],
|
|
||||||
'`money1`' => $pl['money'],
|
|
||||||
'`money2`' => $pl['money2'],
|
|
||||||
'`money4`' => $pl['money4'],
|
|
||||||
'`ip`' => $pl['ip'],
|
|
||||||
'`timereg`' => $pl['timereg'],
|
|
||||||
'`ipreg`' => $pl['ipreg'],
|
|
||||||
'`sex`' => $pl['sex'],
|
|
||||||
'`login`' => $pl['login'],
|
|
||||||
'`pass`' => $pl['pass'],
|
|
||||||
'`mail`' => $pl['mail'],
|
|
||||||
'`level`' => $pl['level'],
|
|
||||||
'`exp`' => $pl['exp'],
|
|
||||||
'`online`' => $pl['online'],
|
|
||||||
'`time_kill`' => time(),
|
|
||||||
'`align`' => $pl['align'],
|
|
||||||
'`clan`' => $pl['clan'],
|
|
||||||
'`banned`' => $pl['banned'],
|
|
||||||
'`win`' => $pl['win'],
|
|
||||||
'`lose`' => $pl['lose'],
|
|
||||||
'`nich`' => $pl['nich'],
|
|
||||||
'`marry`' => $pl['marry'],
|
|
||||||
'`send`' => $pl['send'],
|
|
||||||
'`activ`' => $pl['activ'],
|
|
||||||
'`name`' => $pl['name'],
|
|
||||||
'`obraz`' => $pl['obraz'],
|
|
||||||
'`bithday`' => $pl['bithday'],
|
|
||||||
'`host_reg`' => $pl['host_reg'],
|
|
||||||
];
|
|
||||||
mysql_query(addUser($usrData));
|
|
||||||
}
|
|
||||||
$lvl++;
|
|
||||||
}
|
|
@ -1,27 +0,0 @@
|
|||||||
<?php
|
|
||||||
const GAME = true;
|
|
||||||
setlocale(LC_CTYPE, "ru_RU.CP1251");
|
|
||||||
require_once '_incl_data/__config.php';
|
|
||||||
require_once '_incl_data/class/__db_connect.php';
|
|
||||||
|
|
||||||
if (!isset($_GET['tests']) && UserIp::get() != $_SERVER['SERVER_ADDR'] && UserIp::get() != '127.0.0.1' && UserIp::get() != '51.89.6.100') {
|
|
||||||
exit(UserIp::get() . '<br>' . $_SERVER['SERVER_ADDR']);
|
|
||||||
}
|
|
||||||
|
|
||||||
//Ïîäàåì òóðíèð (õàîò) äëÿ 8-11 óðîâíåé
|
|
||||||
$pdo = \Core\Database::pdoinit();
|
|
||||||
$inc = $pdo->prepare(
|
|
||||||
'insert into zayvki (`comment`,`arand`,`noatack`,`city`,`creator`,`type`,`time_start`,`timeout`,`min_lvl_1`,`min_lvl_2`,`max_lvl_1`,`max_lvl_2`,`noinc`,`razdel`,`time`,`fastfight`,`priz`,`maxplayers`,`tm1max`,`tm2max`) values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,unix_timestamp(),?,?,?,?,?)'
|
|
||||||
)->execute(
|
|
||||||
[
|
|
||||||
"<i style='color: green;'>Àâòîçàÿâêà! <b>Òåñò ïðîøó íå çàõîäèòü</b></i>",
|
|
||||||
1, 1, 'capitalcity', 0, 33, 300, 180, 8, 8, 12, 12, 1, 5, 1, 1, 40, 0, 0,
|
|
||||||
]
|
|
||||||
);
|
|
||||||
|
|
||||||
$pdo->prepare('insert into chat (`text`,`type`,`new`,`time`) values (?,?,?,unix_timestamp())')
|
|
||||||
->execute(
|
|
||||||
["<span style='color: red'>Âíèìàíèå!!!</span> <span style='color:#cb0000'><b>Ãåðîè÷åñêîå Ñðàæåíèå</b> íà÷àëîñü.</span>", 6, 1,]
|
|
||||||
);
|
|
||||||
|
|
||||||
echo $inc ? 'true' : 'false';
|
|
111
cron_psh.php
111
cron_psh.php
@ -1,111 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
function getIP()
|
|
||||||
{
|
|
||||||
return getIPblock();
|
|
||||||
}
|
|
||||||
|
|
||||||
# Ïîëó÷àåì IP
|
|
||||||
function getIPblock()
|
|
||||||
{
|
|
||||||
if (isset($_SERVER['HTTP_X_REAL_IP'])) {
|
|
||||||
return $_SERVER['HTTP_X_REAL_IP'];
|
|
||||||
}
|
|
||||||
return $_SERVER['REMOTE_ADDR'];
|
|
||||||
}
|
|
||||||
|
|
||||||
# Âûïîëíÿåì ïðîâåðêó áåçîïàñíîñòè.
|
|
||||||
|
|
||||||
if ($_SERVER['HTTP_CF_CONNECTING_IP'] != $_SERVER['SERVER_ADDR'] && $_SERVER['HTTP_CF_CONNECTING_IP'] != '127.0.0.1') {
|
|
||||||
die('Hello pussy!');
|
|
||||||
}
|
|
||||||
if (getIPblock() != $_SERVER['SERVER_ADDR'] && getIPblock() != '127.0.0.1' && getIPblock() != '' && getIPblock(
|
|
||||||
) != '5.187.7.71') {
|
|
||||||
die(getIPblock() . '<br>' . $_SERVER['SERVER_ADDR']);
|
|
||||||
}
|
|
||||||
|
|
||||||
const GAME = true;
|
|
||||||
|
|
||||||
require_once('_incl_data/__config.php');
|
|
||||||
require_once('_incl_data/class/__db_connect.php');
|
|
||||||
$d = new Dungeon;
|
|
||||||
$d->start();
|
|
||||||
|
|
||||||
function send_chat($type, $from, $text, $time)
|
|
||||||
{
|
|
||||||
mysql_query(
|
|
||||||
'INSERT INTO `chat` (`text`,`city`,`login`,`to`,`type`,`new`,`time`,`room`) VALUES ("' . mysql_real_escape_string(
|
|
||||||
$text
|
|
||||||
) . '","capitalcity","' . mysql_real_escape_string(
|
|
||||||
$from
|
|
||||||
) . '","","' . $type . '","1","' . mysql_real_escape_string($time) . '","3")'
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
//Ðîçûãðûø ïðåäìåòîâ
|
|
||||||
$sp = mysql_query('SELECT * FROM `dungeon_items` WHERE `user` = 0 AND `take` = 0');
|
|
||||||
while ($pl = mysql_fetch_array($sp)) {
|
|
||||||
$fxv = ['itm' => mysql_fetch_array(
|
|
||||||
mysql_query(
|
|
||||||
'SELECT `im`.*,`ish`.* FROM `dungeon_items` AS `ish` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `ish`.`item_id`) WHERE `ish`.`id` = "' . mysql_real_escape_string(
|
|
||||||
$pl['id']
|
|
||||||
) . '" AND `ish`.`take` = "0" AND `ish`.`delete` = "0" LIMIT 1'
|
|
||||||
)
|
|
||||||
), 'luck_count' => mysql_fetch_array(
|
|
||||||
mysql_query(
|
|
||||||
'SELECT COUNT(*) FROM `dungeon_actions` WHERE `dn` = "' . $pl['dn'] . '" AND `vars` = "luck_itm' . mysql_real_escape_string(
|
|
||||||
$pl['id']
|
|
||||||
) . '" LIMIT 1'
|
|
||||||
)
|
|
||||||
), 'user_count' => mysql_fetch_array(
|
|
||||||
mysql_query('SELECT COUNT(*) FROM `stats` WHERE `dnow` = "' . $pl['dn'] . '" LIMIT 1')
|
|
||||||
)];
|
|
||||||
$fxv['luck_count'] = $fxv['luck_count'][0];
|
|
||||||
$fxv['user_count'] = $fxv['user_count'][0];
|
|
||||||
|
|
||||||
if ($fxv['itm']['user'] <= 0 && $fxv['luck_count'] >= 1 && ($fxv['luck_count'] >= $fxv['user_count'] || $fxv['itm']['time'] + 300 < time(
|
|
||||||
))) {
|
|
||||||
$fxv['sp'] = mysql_query(
|
|
||||||
'SELECT * FROM `dungeon_actions` WHERE `dn` = "' . $pl['dn'] . '" AND `vars` = "luck_itm' . mysql_real_escape_string(
|
|
||||||
$pl['id']
|
|
||||||
) . '" ORDER BY `vals` DESC LIMIT ' . $fxv['luck_count']
|
|
||||||
);
|
|
||||||
$fxv['winner'] = [];
|
|
||||||
$fxv['win_val'] = 0;
|
|
||||||
while ($fxv['pl'] = mysql_fetch_array($fxv['sp'])) {
|
|
||||||
if ($fxv['pl']['vals'] > $fxv['win_val']) {
|
|
||||||
//Ïîáåäèòåëü
|
|
||||||
unset($fxv['winner']);
|
|
||||||
$fxv['winner'][] = $fxv['pl']['uid'];
|
|
||||||
$fxv['win_val'] = $fxv['pl']['vals'];
|
|
||||||
} elseif ($fxv['pl']['vals'] > 0 && $fxv['pl']['vals'] == $fxv['win_val']) {
|
|
||||||
//íè÷üÿ
|
|
||||||
$fxv['winner'][] = $fxv['pl']['uid'];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
unset($fxv['pl'], $fxv['sp']);
|
|
||||||
if (count($fxv['winner']) > 1) {
|
|
||||||
//Ðîçûãðûø åùå ðàç ìåæäó ïîáåäèòåëÿìè
|
|
||||||
$fxv['text'] = 'test2';
|
|
||||||
} elseif (count($fxv['winner']) == 1) {
|
|
||||||
$fxv['user_win'] = mysql_fetch_array(
|
|
||||||
mysql_query(
|
|
||||||
'SELECT `id`,`login`,`sex`,`city`,`room` FROM `users` WHERE `id` = "' . $fxv['winner'][0] . '" LIMIT 1'
|
|
||||||
)
|
|
||||||
);
|
|
||||||
$fxv['text'] = '<b>' . $fxv['user_win']['login'] . '</b> âûèãðûâàåò â ñïîðå çà ïðåäìåò "' . $fxv['itm']['name'] . '"';
|
|
||||||
mysql_query(
|
|
||||||
"INSERT INTO `chat` (`dn`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`,`typeTime`,`new`) VALUES ('" . $pl['dn'] . "','" . $fxv['user_win']['city'] . "','" . $fxv['user_win']['room'] . "','','','" . $fxv['text'] . "','" . time(
|
|
||||||
) . "','6','0','1','1')"
|
|
||||||
);
|
|
||||||
mysql_query(
|
|
||||||
'UPDATE `dungeon_items` SET `time` = "' . time(
|
|
||||||
) . '",`user` = "' . $fxv['user_win']['id'] . '" WHERE `id` = "' . $fxv['itm']['id'] . '" LIMIT 1'
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
//Ëþáîé ìîæåò ïîäîáðàòü ïðåäìåò
|
|
||||||
mysql_query('UPDATE `dungeon_items` SET `user` = "1" WHERE `id` = "' . $pl['id'] . '" LIMIT 1');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
unset($fxv);
|
|
||||||
}
|
|
79
cron_q.php
79
cron_q.php
@ -1,79 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
define('GAME',true);
|
|
||||||
setlocale(LC_CTYPE ,"ru_RU.CP1251");
|
|
||||||
require_once('_incl_data/__config.php');
|
|
||||||
require_once('_incl_data/class/__db_connect.php');
|
|
||||||
|
|
||||||
$html = '';
|
|
||||||
|
|
||||||
$x = 0;
|
|
||||||
$y = 0;
|
|
||||||
|
|
||||||
$sp = mysql_query('SELECT `id`,`battle`,`room` FROM `users` WHERE `real` = 1');
|
|
||||||
while( $pl = mysql_fetch_array($sp) ) {
|
|
||||||
//
|
|
||||||
$bot_kill = array();
|
|
||||||
//
|
|
||||||
$qp = mysql_query('SELECT `vars` FROM `actions` WHERE `uid` = "'.$pl['id'].'" AND `vars` LIKE "%start_quest%" AND `vals` = "go"');
|
|
||||||
while( $ql = mysql_fetch_array($qp) ) {
|
|
||||||
$qst_id = str_replace('start_quest','',$ql['vars']);
|
|
||||||
$qst = mysql_fetch_array(mysql_query('SELECT `act_date` FROM `quests` WHERE `id` = "'.$qst_id.'" LIMIT 1'));
|
|
||||||
if(isset($qst['act_date'])) {
|
|
||||||
$act = explode(':|:',$qst['act_date']);
|
|
||||||
$i = 0;
|
|
||||||
while( $i < count($act) ) {
|
|
||||||
$act2 = explode(':=:',$act[$i]);
|
|
||||||
$bots = explode(',',$act2[1]);
|
|
||||||
$j = 0;
|
|
||||||
while( $j < count($bots) ) {
|
|
||||||
$bot = explode('=',$bots[$j]);
|
|
||||||
$bot_kill[$bot[0]] = true;
|
|
||||||
$j++;
|
|
||||||
}
|
|
||||||
$i++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//
|
|
||||||
$delete = '';
|
|
||||||
$wp = mysql_query('SELECT `id`,`vars` FROM `actions` WHERE `uid` = "'.$pl['id'].'" AND ( `vars` LIKE "win_bot_%" OR `vars` LIKE "lose_bot_%" OR `vars` LIKE "nich_bot_%" )');
|
|
||||||
while( $wl = mysql_fetch_array($wp) ) {
|
|
||||||
$wlb = str_replace('win_bot_','',$wl['vars']);
|
|
||||||
$wlb = str_replace('lose_bot_','',$wlb);
|
|
||||||
$wlb = str_replace('nich_bot_','',$wlb);
|
|
||||||
if( !isset($bot_kill[$wlb]) ) {
|
|
||||||
$delete .= 'OR `id` = "'.$wl['id'].'" ';
|
|
||||||
$x++;
|
|
||||||
}else{
|
|
||||||
//àêòèâíûé êâåñò
|
|
||||||
$y++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$delete = ltrim($delete,'OR ');
|
|
||||||
if( $delete != '' ) {
|
|
||||||
mysql_query('DELETE FROM `actions` WHERE ' . $delete);
|
|
||||||
}
|
|
||||||
//
|
|
||||||
if( $pl['battle'] == 0 ) {
|
|
||||||
$x2 = mysql_query('SELECT COUNT(`id`) FROM `actions` WHERE `uid` = "'.$pl['id'].'" AND (
|
|
||||||
`vars` LIKE "%use_priem_%" OR
|
|
||||||
`vars` LIKE "%animal_use%" OR
|
|
||||||
( `vars` LIKE "%takeit_%" AND `room` != "'.$pl['room'].'" )
|
|
||||||
) LIMIT 1');
|
|
||||||
$x += $x2[0];
|
|
||||||
mysql_query('DELETE FROM `actions` WHERE `uid` = "'.$pl['id'].'" AND (
|
|
||||||
`vars` LIKE "%use_priem_%" OR
|
|
||||||
`vars` LIKE "%animal_use%" OR
|
|
||||||
( `vars` LIKE "%takeit_%" AND `room` != "'.$pl['room'].'" )
|
|
||||||
)');
|
|
||||||
}
|
|
||||||
//
|
|
||||||
}
|
|
||||||
|
|
||||||
$html .= 'Áåñïîëåçíûõ çàïèñåé: '.$x.'<br>';
|
|
||||||
$html .= 'Àêòèâíûõ çàïèñåé: '.$y.'';
|
|
||||||
|
|
||||||
echo $html;
|
|
||||||
|
|
||||||
?>
|
|
@ -1,15 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
//die('×òî-òî òóò íå òàê...');
|
|
||||||
|
|
||||||
define('GAME',true);
|
|
||||||
require_once('_incl_data/class/__db_connect.php');
|
|
||||||
|
|
||||||
//ðåéòèíã ïåðñîíàæåé
|
|
||||||
|
|
||||||
$sp = mysql_query('SELECT * FROM `users_rating` ORDER BY `id` DESC');
|
|
||||||
while( $pl = mysql_fetch_array($sp) ) {
|
|
||||||
echo '['.$pl['uid'].']<br>';
|
|
||||||
}
|
|
||||||
|
|
||||||
?>
|
|
@ -1,198 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
|
|
||||||
const GAME = true;
|
|
||||||
require_once('_incl_data/__config.php');
|
|
||||||
require_once('_incl_data/class/__db_connect.php');
|
|
||||||
|
|
||||||
if (!isset($_GET['test']) && UserIp::get() != $_SERVER['SERVER_ADDR'] && UserIp::get() != '127.0.0.1' && UserIp::get() != '' && UserIp::get() != '31.131.97.206') {
|
|
||||||
die(UserIp::get() . '<br>' . $_SERVER['SERVER_ADDR']);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
function e($t)
|
|
||||||
{
|
|
||||||
mysql_query(
|
|
||||||
'INSERT INTO `chat` (`text`,`city`,`to`,`type`,`new`,`time`) VALUES ("core #' . date('d.m.Y') . ' %' . date(
|
|
||||||
'H:i:s'
|
|
||||||
) . ' ( ðèòè÷åñêठîøèáêà): <b>' . mysql_real_escape_string($t) . '</b>","capitalcity","LEL","6","1","-1")'
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
function testMonster($mon, $type, $mbk)
|
|
||||||
{
|
|
||||||
$r = true;
|
|
||||||
$mbk2 = '';
|
|
||||||
if (isset($mon['id'])) {
|
|
||||||
//
|
|
||||||
if ($type == 'start') {
|
|
||||||
//?åíü íåäåëè
|
|
||||||
if ($mon['start_day'] != -1) {
|
|
||||||
if (($mon['start_day'] < 7 && $mon['start_day'] != (int)date('w')) || $mon['start_day'] != 7) {
|
|
||||||
$r = false;
|
|
||||||
$mbk2 .= '(íåäåëÿ)';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//?èñëî
|
|
||||||
if ($mon['start_dd'] != -1) {
|
|
||||||
if ($mon['start_dd'] != date('j')) {
|
|
||||||
$r = false;
|
|
||||||
$mbk2 .= '(÷èñëî)';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//ìåñ²ö
|
|
||||||
if ($mon['start_mm'] != -1) {
|
|
||||||
if ($mon['start_mm'] != date('n')) {
|
|
||||||
$r = false;
|
|
||||||
$mbk2 .= '(ìåñÿö)';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//÷àñ
|
|
||||||
if ($mon['start_hh'] != -1) {
|
|
||||||
if ($mon['start_hh'] != (int)date('H')) {
|
|
||||||
$r = false;
|
|
||||||
$mbk2 .= '(' . $mon['start_hh'] . '|' . ((int)date('H')) . ' ÷àñ)';
|
|
||||||
}
|
|
||||||
if ($mon['start_min'] != -1) {
|
|
||||||
if ($mon['start_min'] < (int)date('i')) {
|
|
||||||
$r = false;
|
|
||||||
$mbk2 .= '(' . $mon['start_min'] . '|' . ((int)date('i')) . ' ìèíóòû)';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} elseif ($type == 'back') {
|
|
||||||
//?åíü íåäåëè
|
|
||||||
if ($mon['back_day'] != -1) {
|
|
||||||
if (($mon['back_day'] < 7 && $mon['back_day'] != date('w')) || $mon['back_day'] != 7) {
|
|
||||||
$r = false;
|
|
||||||
$mbk2 .= '(äåíü íåäåëè)';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//?èñëî
|
|
||||||
if ($mon['back_dd'] != -1) {
|
|
||||||
if ($mon['back_dd'] != date('j')) {
|
|
||||||
$r = false;
|
|
||||||
$mbk2 .= '(÷èñëî)';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//ìåñ²ö
|
|
||||||
if ($mon['back_mm'] != -1) {
|
|
||||||
if ($mon['back_mm'] != date('n')) {
|
|
||||||
$r = false;
|
|
||||||
$mbk2 .= '(ìåñÿö)';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//÷àñ
|
|
||||||
if ($mon['back_hh'] != -1) {
|
|
||||||
if ($mon['back_hh'] != (int)date('H')) {
|
|
||||||
$r = false;
|
|
||||||
$mbk2 .= '(÷àñ)';
|
|
||||||
}
|
|
||||||
if ($mon['back_min'] != -1) {
|
|
||||||
if ($mon['back_min'] < (int)date('i')) {
|
|
||||||
$r = false;
|
|
||||||
$mbk2 .= '(ìèíóòû)';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
//÷òî-òî äðóãîå
|
|
||||||
$r = false;
|
|
||||||
$mbk2 .= '(÷òî-òî äðóãîå)';
|
|
||||||
}
|
|
||||||
//
|
|
||||||
}
|
|
||||||
if ($mbk == true) {
|
|
||||||
return $mbk2;
|
|
||||||
} else {
|
|
||||||
return $r;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$sp = mysql_query(
|
|
||||||
'SELECT `u`.*,`st`.* FROM `users` AS `u` LEFT JOIN `stats` AS `st` ON `st`.`id` = `u`.`id` WHERE `u`.`no_ip` = "trupojor" LIMIT 100'
|
|
||||||
);
|
|
||||||
while ($pl = mysql_fetch_array($sp)) {
|
|
||||||
$act = 0;
|
|
||||||
if ($pl['online'] < time() - 60) {
|
|
||||||
$pl['online'] = time();
|
|
||||||
mysql_query('UPDATE `users` SET `online` = "' . $pl['online'] . '" WHERE `id` = "' . $pl['id'] . '" LIMIT 1');
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($pl['res_x'] < time() /*&& !isset($testb['id'])*/) {
|
|
||||||
//¸îæíî äåéñòâîâàòü!
|
|
||||||
$mon = mysql_fetch_array(mysql_query('SELECT * FROM `aaa_monsters` WHERE `uid` = "' . $pl['id'] . '" LIMIT 1'));
|
|
||||||
if (isset($mon['id'])) {
|
|
||||||
if (testMonster($mon, 'start', false) == true && $pl['room'] == 303) {
|
|
||||||
$pl['room'] = $mon['start_room'];
|
|
||||||
mysql_query(
|
|
||||||
'UPDATE `users` SET `room` = "' . $pl['room'] . '" WHERE `id` = "' . $pl['id'] . '" LIMIT 1'
|
|
||||||
);
|
|
||||||
mysql_query(
|
|
||||||
'UPDATE `stats` SET `hpNow` = "1000000000000",`mpNow` = "1000000000000" WHERE `id` = "' . $pl['id'] . '" LIMIT 1'
|
|
||||||
);
|
|
||||||
if ($mon['start_text'] != '' /*&& $pl['level'] <10*/) {
|
|
||||||
mysql_query(
|
|
||||||
'INSERT INTO `chat` (`text`,`city`,`to`,`type`,`new`,`time`) VALUES ("<font color=red>Âíèìàíèå!</font> ' . mysql_real_escape_string(
|
|
||||||
str_replace(
|
|
||||||
'{b}',
|
|
||||||
'<b>' . $pl['login'] . '</b> [' . $pl['level'] . ']<a target=_blank href=inf.php?' . $pl['id'] . ' ><img width=12 height=11 src=https://img.new-combats.com/i/inf_capitalcity.gif ></a>',
|
|
||||||
$mon['start_text']
|
|
||||||
)
|
|
||||||
) . '","' . $pl['city'] . '","","6","1","' . time() . '")'
|
|
||||||
);
|
|
||||||
}
|
|
||||||
$act = 1;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
mysql_query(
|
|
||||||
'UPDATE `stats` SET `res_x` = "' . (time() + 3600) . '" WHERE `id` = "' . $pl['id'] . '" LIMIT 1'
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($act == 0 && $pl['room'] != 303 && $pl['battle'] == 0) {
|
|
||||||
if (!isset($mon['id'])) {
|
|
||||||
$mon = mysql_fetch_array(
|
|
||||||
mysql_query('SELECT * FROM `aaa_monsters` WHERE `uid` = "' . $pl['id'] . '" LIMIT 1')
|
|
||||||
);
|
|
||||||
}
|
|
||||||
if (isset($mon['id'])) {
|
|
||||||
if (testMonster($mon, 'back', false) == true) {
|
|
||||||
$pl['room'] = 303;
|
|
||||||
mysql_query(
|
|
||||||
'UPDATE `users` SET `room` = "' . $pl['room'] . '" WHERE `id` = "' . $pl['id'] . '" LIMIT 1'
|
|
||||||
);
|
|
||||||
mysql_query(
|
|
||||||
'UPDATE `stats` SET `hpNow` = "1000000000000",`mpNow` = "1000000000000" WHERE `id` = "' . $pl['id'] . '" LIMIT 1'
|
|
||||||
);
|
|
||||||
if ($mon['back_text'] != '') {
|
|
||||||
mysql_query(
|
|
||||||
'INSERT INTO `chat` (`text`,`city`,`to`,`type`,`new`,`time`) VALUES ("<font color=red>Âíèìàíèå!</font> ' . mysql_real_escape_string(
|
|
||||||
str_replace(
|
|
||||||
'{b}',
|
|
||||||
'<b>' . $pl['login'] . '</b> [' . $pl['level'] . ']<a target=_blank href=inf.php?' . $pl['id'] . ' ><img width=12 height=11 src=https://img.new-combats.com/i/inf_capitalcity.gif ></a>',
|
|
||||||
$mon['back_text']
|
|
||||||
)
|
|
||||||
) . '","' . $pl['city'] . '","","6","1","' . time() . '")'
|
|
||||||
);
|
|
||||||
mysql_query(
|
|
||||||
'INSERT INTO `chat` (`text`,`city`,`to`,`type`,`new`,`time`) VALUES ("<font color=red>Âíèìàíèå!</font> ' . mysql_real_escape_string(
|
|
||||||
str_replace(
|
|
||||||
'{b}',
|
|
||||||
'<b>' . $pl['login'] . '</b> [' . $pl['level'] . ']<a target=_blank href=inf.php?' . $pl['id'] . ' ><img width=12 height=11 src=https://img.new-combats.com/i/inf_capitalcity.gif ></a>',
|
|
||||||
$mon['back_text']
|
|
||||||
)
|
|
||||||
) . '","' . $pl['city'] . '","","1","1","' . time() . '")'
|
|
||||||
);
|
|
||||||
}
|
|
||||||
$act = 2;
|
|
||||||
} else {
|
|
||||||
echo '[Îæèäàíèå: ' . $mon['id'] . ' -> ' . $mon['login'] . ' | ' . testMonster(
|
|
||||||
$mon, 'back', true
|
|
||||||
) . ']<br>';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
usleep(300000);
|
|
||||||
}
|
|
@ -1,80 +0,0 @@
|
|||||||
<?php
|
|
||||||
const GAME = true;
|
|
||||||
setlocale(LC_CTYPE, "ru_RU.CP1251");
|
|
||||||
include('_incl_data/__config.php');
|
|
||||||
include('_incl_data/class/__db_connect.php');
|
|
||||||
$u = User::start();
|
|
||||||
|
|
||||||
if (!isset($_GET['test']) && UserIp::get() != $_SERVER['SERVER_ADDR'] && UserIp::get() != '127.0.0.1' && UserIp::get(
|
|
||||||
) != '' && UserIp::get() != '31.131.97.206') {
|
|
||||||
die(UserIp::get() . '<br>' . $_SERVER['SERVER_ADDR']);
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
$sp = mysql_query('SELECT * FROM `battle` WHERE `otmorozok` = 1 AND `team_win` = -1 AND `otmorozok_use` = 0');
|
|
||||||
while ($pl = mysql_fetch_array($sp)) {
|
|
||||||
if (rand(0, 100) < 11) {
|
|
||||||
//
|
|
||||||
mysql_query('UPDATE `battle` SET `otmorozok_use` = 1 WHERE `id` = "' . $pl['id'] . '" LIMIT 1');
|
|
||||||
//
|
|
||||||
$usr = mysql_fetch_array(
|
|
||||||
mysql_query(
|
|
||||||
'SELECT `level`,`city` FROM `users` WHERE `battle` = "' . $pl['id'] . '" ORDER BY `level` DESC LIMIT 1'
|
|
||||||
)
|
|
||||||
);
|
|
||||||
$bot = mysql_fetch_array(
|
|
||||||
mysql_query('SELECT * FROM `test_bot` WHERE `login` LIKE "%Îòìîðîçîê [%' . $usr['level'] . '%]%" LIMIT 1')
|
|
||||||
);
|
|
||||||
//
|
|
||||||
$tmr = rand(1, 2);
|
|
||||||
//
|
|
||||||
$logins_bot = [];
|
|
||||||
$bot = $u->addNewbot($bot['id'], null, null, $logins_bot, null);
|
|
||||||
$otmz = mysql_fetch_array(
|
|
||||||
mysql_query(
|
|
||||||
'SELECT COUNT(*) FROM `users` WHERE `login` LIKE "%Îòìîðîçîê (%" AND `battle` = "' . $pl['id'] . '" LIMIT 1'
|
|
||||||
)
|
|
||||||
);
|
|
||||||
//
|
|
||||||
$otmz[0]++;
|
|
||||||
//
|
|
||||||
mysql_query(
|
|
||||||
'UPDATE `users` SET `city` = "' . $usr['city'] . '",`login` = "Îòìîðîçîê (' . $otmz[0] . ')",`battle` = "' . $pl['id'] . '" WHERE `id` = "' . $bot['id'] . '" LIMIT 1'
|
|
||||||
);
|
|
||||||
//
|
|
||||||
mysql_query('UPDATE `stats` SET `team` = "' . $tmr . '" WHERE `id` = "' . $bot['id'] . '" LIMIT 1');
|
|
||||||
//
|
|
||||||
$vtvl = '{tm1} {u1} âìåøàëñÿ â ïîåäèíîê. Õî! õî! õî!';
|
|
||||||
$last_hod = mysql_fetch_array(
|
|
||||||
mysql_query(
|
|
||||||
'SELECT `id_hod` FROM `battle_logs` WHERE `battle` = "' . $pl['id'] . '" ORDER BY `id_hod` DESC LIMIT 1'
|
|
||||||
)
|
|
||||||
);
|
|
||||||
$last_hod = $last_hod['id_hod'];
|
|
||||||
//
|
|
||||||
$mass = [
|
|
||||||
'time' => time(),
|
|
||||||
'battle' => $pl['id'],
|
|
||||||
'id_hod' => ($last_hod + 1),
|
|
||||||
'vars' => '||time1=' . time() . '||time2=0||s1=0||t1=' . $tmr . '||login1=Îòìîðîçîê (' . $otmz[0] . ')',
|
|
||||||
'type' => 1,
|
|
||||||
];
|
|
||||||
//
|
|
||||||
$ins = mysql_query(
|
|
||||||
'INSERT INTO `battle_logs` (
|
|
||||||
`time`,`battle`,`id_hod`,`text`,`vars`,`zona1`,`zonb1`,`zona2`,`zonb2`,`type`
|
|
||||||
) VALUES (
|
|
||||||
"' . $mass['time'] . '",
|
|
||||||
"' . $mass['battle'] . '",
|
|
||||||
"' . $mass['id_hod'] . '",
|
|
||||||
"' . $vtvl . '",
|
|
||||||
"' . $mass['vars'] . '",
|
|
||||||
"",
|
|
||||||
"",
|
|
||||||
"",
|
|
||||||
"",
|
|
||||||
"' . $mass['type'] . '"
|
|
||||||
)'
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
26
cron_zv.php
26
cron_zv.php
@ -1,26 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
# Ïîëó÷àåì IP
|
|
||||||
use Insallah\Db;
|
|
||||||
|
|
||||||
const GAME = true;
|
|
||||||
|
|
||||||
include('_incl_data/__config.php');
|
|
||||||
include('_incl_data/class/__db_connect.php');
|
|
||||||
|
|
||||||
$query = 'select id, pass from users where battle in (select id from battle where team_win = -1 and time_over = 0 and time_start < unix_timestamp() - 3600)';
|
|
||||||
$sp = Db::getRows($query);
|
|
||||||
|
|
||||||
foreach ($sp as $pl) {
|
|
||||||
if (!$pl['id']) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
$uid = $pl['id'];
|
|
||||||
$pass = $pl['pass'];
|
|
||||||
$cron_core = md5($uid . '_brfCOreW@!_' . $pass);
|
|
||||||
echo file_get_contents("https://new-combats.com/jx/battle/refresh.php?uid=$uid&cron_core=$cron_core&pass=$pass");
|
|
||||||
echo '<hr>';
|
|
||||||
}
|
|
||||||
|
|
||||||
$zv = new FightRequest();
|
|
||||||
$zv->testCronZv();
|
|
46
ekr.php
46
ekr.php
@ -648,28 +648,10 @@ if (!isset($backdoor)) {
|
|||||||
$url = 'https://pay.freekassa.ru/?';
|
$url = 'https://pay.freekassa.ru/?';
|
||||||
$url .= 'm=' . $mrh_login . '&';
|
$url .= 'm=' . $mrh_login . '&';
|
||||||
$url .= 'oa=' . $out_summ . '&';
|
$url .= 'oa=' . $out_summ . '&';
|
||||||
//$url .= 'InvId='.$inv_id.'&';
|
|
||||||
//$url .= 'Desc='.$inv_desc.'&';
|
|
||||||
$url .= 'currency=' . $currency . '&';
|
$url .= 'currency=' . $currency . '&';
|
||||||
$url .= 'o=' . $shp_item . '&';
|
$url .= 'o=' . $shp_item . '&';
|
||||||
$url .= 's=' . $crc;
|
$url .= 's=' . $crc;
|
||||||
//$url .= 'i='.$in_curr.'&';
|
|
||||||
//$url .= 'lang='.$culture.'&';
|
|
||||||
//
|
|
||||||
|
|
||||||
/*
|
|
||||||
<form method='get' action='https://pay.freekassa.ru/'>
|
|
||||||
<input type='hidden' name='m' value='<?php=$merchant_id?>'>
|
|
||||||
<input type='hidden' name='oa' value='<?php=$order_amount?>'>
|
|
||||||
<input type='hidden' name='o' value='<?php=$order_id?>'>
|
|
||||||
<input type='hidden' name='s' value='<?php=$sign?>'>
|
|
||||||
<input type='hidden' name='currency' value='<?php=$currency?>'>
|
|
||||||
<input type='hidden' name='i' value='1'>
|
|
||||||
<input type='hidden' name='lang' value='ru'>
|
|
||||||
<input type='hidden' name='us_login' value='<?php=$user['login']?>'>
|
|
||||||
<input type='submit' name='pay' value='¿¿¿¿¿¿¿¿'>
|
|
||||||
</form>
|
|
||||||
*/
|
|
||||||
header('location: ' . $url);
|
header('location: ' . $url);
|
||||||
die();
|
die();
|
||||||
print "<html>" .
|
print "<html>" .
|
||||||
@ -798,7 +780,6 @@ if (!isset($backdoor)) {
|
|||||||
?>
|
?>
|
||||||
<a href="https://new-combats.com/ekr.php"> <img border="0" alt="freekassa" src="image/free.png" width="300"
|
<a href="https://new-combats.com/ekr.php"> <img border="0" alt="freekassa" src="image/free.png" width="300"
|
||||||
height="110"></a> 
|
height="110"></a> 
|
||||||
<!-- <a href="https://new-combats.com/ekr2.php"> <img border="0" alt="interkassa" src="image/inter2.png" width="300" height="110"></a> -->
|
|
||||||
<tr>
|
<tr>
|
||||||
<td style="width: 500px; padding: 10px; vertical-align: top;">
|
<td style="width: 500px; padding: 10px; vertical-align: top;">
|
||||||
<fieldset style="border: 1px solid white; padding: 10px;margin-top:15px;">
|
<fieldset style="border: 1px solid white; padding: 10px;margin-top:15px;">
|
||||||
@ -1145,7 +1126,7 @@ if (!isset($backdoor)) {
|
|||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td style="padding: 10px; vertical-align: top;">
|
<td colspan="2" style="padding: 10px; vertical-align: top;">
|
||||||
|
|
||||||
<!-- komplekt form -->
|
<!-- komplekt form -->
|
||||||
<div class="komplekt-form" id="theLayer"
|
<div class="komplekt-form" id="theLayer"
|
||||||
@ -1187,8 +1168,9 @@ if (!isset($backdoor)) {
|
|||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!-- end komplekt form -->
|
<table style="width: 100%">
|
||||||
<fieldset style="width:480px; border: 1px solid white; padding: 10px;margin-top:15px;">
|
<tr>
|
||||||
|
<td style="vertical-align: baseline;"><fieldset style="width:480px; border: 1px solid white; padding: 10px;margin:15px;">
|
||||||
<legend style='font-weight:bold; color:#8F0000;'>Ïîêóïêà ëè÷íîãî îáðàçà</legend>
|
<legend style='font-weight:bold; color:#8F0000;'>Ïîêóïêà ëè÷íîãî îáðàçà</legend>
|
||||||
<small>
|
<small>
|
||||||
<b>Ñòîèìîñòü óñëóãè: 100 ÅÊÐ</b><br>
|
<b>Ñòîèìîñòü óñëóãè: 100 ÅÊÐ</b><br>
|
||||||
@ -1260,9 +1242,8 @@ if (!isset($backdoor)) {
|
|||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
</small>
|
</small>
|
||||||
</fieldset>
|
</fieldset></td>
|
||||||
|
<td style="vertical-align: baseline;"><fieldset style="border: 1px solid white; padding: 10px;margin:15px;">
|
||||||
<fieldset style="border: 1px solid white; padding: 10px;margin-top:15px; padding-bottom: 15px;">
|
|
||||||
<legend style='font-weight:bold; color:#8F0000;'>Ïîêóïêà ëè÷íîãî ñìàéëèêà</legend>
|
<legend style='font-weight:bold; color:#8F0000;'>Ïîêóïêà ëè÷íîãî ñìàéëèêà</legend>
|
||||||
<small>
|
<small>
|
||||||
<b>Ñòîèìîñòü óñëóãè: <?php $ekr_smile = 10;
|
<b>Ñòîèìîñòü óñëóãè: <?php $ekr_smile = 10;
|
||||||
@ -1298,9 +1279,8 @@ if (!isset($backdoor)) {
|
|||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
</small>
|
</small>
|
||||||
</fieldset>
|
</fieldset></td>
|
||||||
|
<td style="vertical-align: baseline;"><fieldset style="border: 1px solid white; padding: 10px;margin:15px;">
|
||||||
<fieldset style="border: 1px solid white; padding: 10px;margin-top:15px;">
|
|
||||||
<legend style='font-weight:bold; color:#8F0000;'>Ñìåíà èìåíè ïåðñîíàæà</legend>
|
<legend style='font-weight:bold; color:#8F0000;'>Ñìåíà èìåíè ïåðñîíàæà</legend>
|
||||||
<small>
|
<small>
|
||||||
<b>Ñòîèìîñòü óñëóãè: 25 ÅÊÐ</b><br>
|
<b>Ñòîèìîñòü óñëóãè: 25 ÅÊÐ</b><br>
|
||||||
@ -1325,7 +1305,15 @@ if (!isset($backdoor)) {
|
|||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
</small>
|
</small>
|
||||||
</fieldset>
|
</fieldset></td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<!-- end komplekt form -->
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
1014
ekr2.bac.old.php
1014
ekr2.bac.old.php
File diff suppressed because it is too large
Load Diff
1006
ekr2.bac.oldN.php
1006
ekr2.bac.oldN.php
File diff suppressed because it is too large
Load Diff
1000
ekr2.bac.php
1000
ekr2.bac.php
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user