game/AI.php

225 lines
7.2 KiB
PHP

<?php
/*
Ядро для обработки данных.
Обработка поединков, обработка заявок, обработка ботов, обработка пещер, обработка турниров, обработка временных генераций
*/
use User\UserIp;
if (isset($_GET['m1'])) {
define('GAME', true);
include_once '_incl_data/__config.php';
include_once '_incl_data/class/__db_connect.php';
$sp = mysql_query('SELECT * FROM `users_recombats` WHERE `email` != "" ORDER BY `name` DESC LIMIT 7000');
while ($pl = mysql_fetch_array($sp)) {
echo "<br>" . $pl['email'];
}
} elseif (isset($_GET['bk1'])) {
define('GAME', true);
include('_incl_data/__config.php');
include('_incl_data/class/__db_connect.php');
$u = User::start();
$ins = 'Вещи БК-1:<hr>';
$sp = mysql_query('SELECT * FROM `items_main` WHERE `geni` = 1');
while ($pl = mysql_fetch_array($sp)) {
$po = mysql_fetch_array(
mysql_query('SELECT * FROM `items_main_data` WHERE `items_id` = "' . $pl['id'] . '" LIMIT 1')
);
$po = ConversionHelper::dataStringToArray($po['data']);
if (!isset($po['add_minAtack']) && isset($po['sv_minAtack'])) {
$po['add_minAtack'] = $po['sv_minAtack'];
$po['add_maxAtack'] = $po['sv_maxAtack'];
}
$ins .= 'INSERT INTO `items_main` (
`id`, `name`, `img`, `art`, `type`, `inslot`, `use_magic`, `price`, `price2`, `iznosMAXi`, `massa`, `tr_level`, `tr_s1`, `tr_s2`, `tr_s3`, `tr_s4`, `tr_s5`, `tr_s6`, `add_s1`, `add_s2`, `add_s3`, `add_s4`, `add_s5`, `add_s6`, `add_hp`, `add_mp`, `add_m1`, `add_m2`, `add_m3`, `add_m4`, `add_b1`, `add_b2`, `add_b3`, `add_b4`, `add_attack_min`, `add_attack_max`
,`tr_a1`,`tr_a2`,`tr_a3`,`tr_a4`,`tr_mg1`,`tr_mg2`,`tr_mg3`,`tr_mg4`,`tr_mg5`,`tr_mg6`,`tr_mg7`
,`add_a1`,`add_a2`,`add_a3`,`add_a4`,`add_mg1`,`add_mg2`,`add_mg3`,`add_mg4`,`add_mg5`,`add_mg6`,`add_mg7`
) VALUES ';
$ins .= '(
NULL,
"' . $pl['name'] . '",
"' . $pl['img'] . '",
"' . (0 + round($po['art'])) . '",
"' . $pl['type'] . '",
"' . $pl['inslot'] . '",
"",
"' . $pl['price1'] . '",
"' . $pl['price2'] . '",
"' . $pl['iznosMAXi'] . '",
"' . $pl['massa'] . '",
"' . (0 + round($po['tr_lvl'])) . '",
"' . (0 + round($po['tr_s1'])) . '",
"' . (0 + round($po['tr_s2'])) . '",
"' . (0 + round($po['tr_s3'])) . '",
"' . (0 + round($po['tr_s4'])) . '",
"' . (0 + round($po['tr_s5'])) . '",
"' . (0 + round($po['tr_s6'])) . '",
"' . (0 + round($po['add_s1'])) . '",
"' . (0 + round($po['add_s2'])) . '",
"' . (0 + round($po['add_s3'])) . '",
"' . (0 + round($po['add_s4'])) . '",
"' . (0 + round($po['add_s5'])) . '",
"' . (0 + round($po['add_s6'])) . '",
"' . (0 + round($po['add_hpAll'])) . '",
"' . (0 + round($po['add_mpAll'])) . '",
"' . (0 + round($po['add_m1'])) . '",
"' . (0 + round($po['add_m2'])) . '",
"' . (0 + round($po['add_m3'])) . '",
"' . (0 + round($po['add_m4'])) . '",
"' . (0 + round($po['add_mib1'])) . '",
"' . (0 + round($po['add_mib2'])) . '",
"' . (0 + round($po['add_mib3'])) . '",
"' . (0 + round($po['add_mib4'])) . '",
"' . (0 + round($po['add_minAtack'])) . '",
"' . (0 + round($po['add_maxAtack'])) . '",
"' . (0 + round($po['tr_a1'])) . '",
"' . (0 + round($po['tr_a2'])) . '",
"' . (0 + round($po['tr_a3'])) . '",
"' . (0 + round($po['tr_a4'])) . '",
"' . (0 + round($po['tr_mg1'])) . '",
"' . (0 + round($po['tr_mg2'])) . '",
"' . (0 + round($po['tr_mg3'])) . '",
"' . (0 + round($po['tr_mg4'])) . '",
"' . (0 + round($po['tr_mg5'])) . '",
"' . (0 + round($po['tr_mg6'])) . '",
"' . (0 + round($po['tr_mg7'])) . '",
"' . (0 + round($po['add_a1'])) . '",
"' . (0 + round($po['add_a2'])) . '",
"' . (0 + round($po['add_a3'])) . '",
"' . (0 + round($po['add_a4'])) . '",
"' . (0 + round($po['add_mg1'])) . '",
"' . (0 + round($po['add_mg2'])) . '",
"' . (0 + round($po['add_mg3'])) . '",
"' . (0 + round($po['add_mg4'])) . '",
"' . (0 + round($po['add_mg5'])) . '",
"' . (0 + round($po['add_mg6'])) . '",
"' . (0 + round($po['add_mg7'])) . '"
);';
$ins .= "\n" . '<br>';
}
echo $ins;
die();
}
if (isset($_GET['test'])) {
$i = 3;
function yrn($sila)
{
return 2 + $_GET['test'] + $sila - round($sila / 5);
}
while ($i <= 100) {
echo '<div';
if ($i == 8 || $i == 13 || $i == 18 || $i == 23) {
echo ' style="background-color:green;color:#fff;"';
} elseif ($i == 7 || $i == 12 || $i == 17 || $i == 22) {
echo ' style="background-color:grey;color:#fff;"';
}
echo '>&nbsp;';
echo $i . ' = ' . yrn($i);
echo '</div>';
$i++;
}
die();
}
if (!isset($_GET['robot']) && UserIp::get() != $_SERVER['SERVER_ADDR'] && UserIp::get() != '127.0.0.1' && UserIp::get(
) != '' && UserIp::get() != '31.131.116.166') {
die(UserIp::get() . '<br>' . $_SERVER['SERVER_ADDR']);
}
const GAME = true;
include('_incl_data/__config.php');
include('_incl_data/class/__db_connect.php');
$count = [0, 0, 0, 0, 0, 0];
function inuser_go_btl($id)
{
if (isset($id['id'])) {
file_get_contents(
'/jx/battle/refresh.php?uid=' . $id['id'] . '&cron_core=' . md5(
$id['id'] . '_brfCOreW@!_' . $id['pass']
) . '&pass=' . $id['pass']
);
}
}
$sp = mysql_query(
'SELECT `u`.* , `s`.* FROM `stats` AS `s` LEFT JOIN `users` AS `u` ON `u`.`id` = `s`.`id` WHERE `u`.`pass` = "botforpeople" ORDER BY `s`.`nextAct` ASC LIMIT 200'
);
$btltest = [];
while ($pl = mysql_fetch_array($sp)) {
$i++;
if ($pl['zv'] == 0 && ($pl['battle'] == 0 || !isset($btltest[$pl['battle']]) || $btltest[$pl['battle']] < 10)) {
$btltest[$pl['battle']]++;
if ($pl['timereg'] == 0) {
mysql_query('UPDATE `users` SET `timereg` = "' . time() . '" WHERE `id` = "' . $pl['id'] . '" LIMIT 1');
} else {
User::setOnline($pl['id']);
}
if ($pl['bot'] == 0) {
mysql_query('UPDATE `stats` SET `bot` = "2" WHERE `id` = "' . $pl['id'] . '" LIMIT 1');
}
User::setOnline($pl['id']);
BotLogic::start($pl['id']);
} else {
if ($pl['zv'] > 0) {
BotLogic::start($pl['id']);
}
if ($pl['timereg'] == 0) {
mysql_query('UPDATE `users` SET `timereg` = "' . time() . '" WHERE `id` = "' . $pl['id'] . '" LIMIT 1');
} else {
User::setOnline($pl['id']);
}
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');
User::setOnline($pl['id']);
echo '*';
}
echo '+';
echo '[' . $pl['login'] . '] -> Действие: ' . $pl['ipreg'] . ' , ожидаем: ' . ($pl['timeMain'] - time(
)) . ' сек., заявка: ' . $pl['zv'] . ', поединок: ' . $pl['battle'] . '';
echo '<hr>';
}