game/cron_bot_core.php

140 lines
6.2 KiB
PHP
Raw Normal View History

2022-06-06 21:30:34 +00:00
<?php
2022-06-06 21:30:34 +00:00
error_reporting(0);
ini_set('display_errors', 'Off');
const GAME = true;
2022-06-06 21:30:34 +00:00
setlocale(LC_CTYPE, "ru_RU.CP1251");
2022-06-06 21:30:34 +00:00
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']
);
}
}
2022-06-06 21:30:34 +00:00
$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');
}
2022-06-06 21:30:34 +00:00
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 '{!}';
}
2022-06-06 21:30:34 +00:00
if ($pl['zv'] == 0 && ($pl['battle'] == 0 || !isset($btltest[$pl['battle']]) || $btltest[$pl['battle']] < 1)) {
2022-06-06 21:30:34 +00:00
$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');
}
}
2022-06-06 21:30:34 +00:00
$ii++;
echo 'TEST:' . $ii;
unset($btltest, $btl_ref, $btltest2);
sleep(4);
2022-06-06 21:30:34 +00:00
}