2022-06-06 21:30:34 +00:00
|
|
|
|
<?php
|
|
|
|
|
|
2023-11-02 13:57:39 +00:00
|
|
|
|
use Core\Config;
|
|
|
|
|
use Core\Db;
|
|
|
|
|
|
2022-06-06 21:30:34 +00:00
|
|
|
|
session_start();
|
2023-11-02 13:57:39 +00:00
|
|
|
|
$tm = microtime(true);
|
2022-06-06 21:30:34 +00:00
|
|
|
|
|
|
|
|
|
if (!isset($CRON_CORE)) {
|
2022-07-01 12:45:43 +00:00
|
|
|
|
require_once('../../_incl_data/__config.php');
|
2022-06-06 21:30:34 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!isset($CRON_CORE)) {
|
|
|
|
|
define('GAME', true);
|
2022-07-01 12:45:43 +00:00
|
|
|
|
require_once('../../_incl_data/class/__db_connect.php');
|
2022-06-06 21:30:34 +00:00
|
|
|
|
}
|
|
|
|
|
|
2023-11-02 13:57:39 +00:00
|
|
|
|
function e($t): void
|
2022-06-06 21:30:34 +00:00
|
|
|
|
{
|
2023-01-28 02:24:37 +00:00
|
|
|
|
(new Chat())->debug($t, true);
|
2022-06-06 21:30:34 +00:00
|
|
|
|
}
|
|
|
|
|
|
2023-11-02 13:57:39 +00:00
|
|
|
|
if (isset($_GET['cron_core'])) { // что ты такое?
|
2022-06-06 21:30:34 +00:00
|
|
|
|
$id = [
|
|
|
|
|
'id' => $_GET['uid'],
|
2022-08-25 11:23:36 +00:00
|
|
|
|
'pass' => $_GET['pass'],
|
2022-06-06 21:30:34 +00:00
|
|
|
|
];
|
|
|
|
|
if (md5($id['id'] . '_brfCOreW@!_' . $id['pass']) == $_GET['cron_core']) {
|
2023-11-02 13:57:39 +00:00
|
|
|
|
|
|
|
|
|
$CRON_CORE = true;
|
|
|
|
|
$_COOKIE['login'] = User::getLoginById($id['id']);
|
|
|
|
|
$_POST['id'] = 'reflesh';
|
2022-06-06 21:30:34 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!isset($CRON_CORE)) {
|
|
|
|
|
header('Expires: Mon, 26 Jul 1970 05:00:00 GMT');
|
|
|
|
|
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
|
|
|
|
|
header('Cache-Control: no-store, no-cache, must-revalidate');
|
|
|
|
|
header('Cache-Control: post-check=0, pre-check=0', false);
|
|
|
|
|
header('Pragma: no-cache');
|
|
|
|
|
}
|
|
|
|
|
|
2023-11-02 13:57:39 +00:00
|
|
|
|
if (
|
|
|
|
|
$_SERVER['HTTP_X_REQUESTED_WITH'] != 'XMLHttpRequest' && !isset($CRON_CORE) ||
|
|
|
|
|
!isset($_POST['atack'], $_POST['block']) && (!isset($_POST['id']) || $_POST['id'] != 'reflesh') && !isset($_POST['usepriem']) && !isset($_POST['useitem'])
|
|
|
|
|
) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
unset($tm);
|
|
|
|
|
$js = '';
|
|
|
|
|
$u = User::start();
|
|
|
|
|
$magic = new Magic();
|
|
|
|
|
$priem = new Priems();
|
|
|
|
|
|
|
|
|
|
if ($u->info['battle'] == 0) {
|
|
|
|
|
$btlLastId = Db::getValue('select id from battle_users where uid = ? and finish = 0 limit 1', [$u->info['id']]);
|
|
|
|
|
if ($btlLastId) {
|
|
|
|
|
echo "<script>document.getElementById('teams').style.display='none'; var battleFinishData = '{$u->info['battle_text']}';</script>";
|
|
|
|
|
$u->info['battle'] = $btlLastId;
|
|
|
|
|
$u->info['battle_lsto'] = true;
|
|
|
|
|
Db::sql("update stats set battle_text = '', last_b = 0 where id = ?", [$u->info['id']]);
|
|
|
|
|
Db::sql('update battle_users set finish = 1 where uid = ?', [$u->info['id']]);
|
|
|
|
|
echo '<script>alert("Поединок для вас завершился.");location.href="main.php?finish=1";</script>';
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!isset($CRON_CORE) && (!isset($u->info['id']) || ($u->info['joinIP'] == 1 && $u->info['ip'] != $_SERVER['HTTP_X_REAL_IP']))) {
|
|
|
|
|
die(Config::get('exit'));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$u->stats = $u->getStats($u->info['id']);
|
|
|
|
|
|
|
|
|
|
if (!isset($CRON_CORE) && $u->info['online'] < time() - 30) {
|
|
|
|
|
Db::sql('update users set online = unix_timestamp(), timeMain = unix_timestamp() where id = ?', [$u->info['id']]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$error = fn(string $str): string => '<div style="color: red; text-align: center; font-weight: bold;">' . $str . '</div>';
|
|
|
|
|
|
|
|
|
|
$btl = new Battle();
|
|
|
|
|
require_once('log_text.php');
|
|
|
|
|
$btl->is = $u->is;
|
|
|
|
|
$btl->items = $u->items;
|
|
|
|
|
$btl->info = $btl->battleInfo($u->info['battle']);
|
|
|
|
|
|
|
|
|
|
if (!isset($btl->info['id'])) {
|
|
|
|
|
if ($u->info['battle'] == -1) {
|
|
|
|
|
//завершаем поединок
|
|
|
|
|
Db::sql('update users set battle = 0, online = unix_timestamp() where id = ?', [$u->info['id']]);
|
|
|
|
|
exit('<script>location="main.php";</script>');
|
|
|
|
|
} else {
|
|
|
|
|
Db::sql('update users set battle = 0 where battle = ?', [$u->info['battle']]);
|
|
|
|
|
if (!isset($CRON_CORE)) {
|
|
|
|
|
exit('<script>location="main.php";</script>');
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
//получаем массив с игроками в бою
|
|
|
|
|
$btl->teamsTake();
|
|
|
|
|
|
|
|
|
|
if (isset($_POST['useitem']) && $btl->testUsersLive()) {
|
|
|
|
|
$magic->useItems((int)$_POST['useitem']);
|
|
|
|
|
if ($u->error != '') {
|
|
|
|
|
echo $error($u->error);
|
2022-06-06 21:30:34 +00:00
|
|
|
|
}
|
2022-08-25 11:23:36 +00:00
|
|
|
|
}
|
2022-06-06 21:30:34 +00:00
|
|
|
|
|
2023-11-02 13:57:39 +00:00
|
|
|
|
//заносим удары,приемы,эффекты и т.д.
|
|
|
|
|
//удар
|
|
|
|
|
if (isset($_POST['atack']) && isset($_POST['block'])) {
|
|
|
|
|
$btl->addAtack();
|
2022-08-25 11:23:36 +00:00
|
|
|
|
}
|
2022-06-06 21:30:34 +00:00
|
|
|
|
|
2023-11-02 13:57:39 +00:00
|
|
|
|
//прием
|
|
|
|
|
if (isset($_POST['usepriem']) && $btl->testUsersLive() && isset($btl->users[$btl->uids[$u->info['enemy']]])) {
|
|
|
|
|
$priem->pruse($_POST['usepriem']);
|
2022-08-25 11:23:36 +00:00
|
|
|
|
}
|
2022-06-06 21:30:34 +00:00
|
|
|
|
|
2023-11-02 13:57:39 +00:00
|
|
|
|
//используем заклятие / пирожки
|
|
|
|
|
//не используем? О_о
|
2022-06-06 21:30:34 +00:00
|
|
|
|
|
|
|
|
|
|
2023-11-02 13:57:39 +00:00
|
|
|
|
//проводим действия (удары, использование приемов, если есть возможность нанести удар или использовать прием)
|
|
|
|
|
$btl->testActions();
|
2022-08-25 11:23:36 +00:00
|
|
|
|
|
2023-11-02 13:57:39 +00:00
|
|
|
|
//авто-смена противника, либо просто смена противника
|
|
|
|
|
if ($u->stats['hpNow'] < 1) {
|
|
|
|
|
$btl->mainStatus = 3;
|
|
|
|
|
} else {
|
|
|
|
|
//ручная смена
|
|
|
|
|
if (isset($_POST['smn']) && $_POST['smn'] != 'none') {
|
|
|
|
|
/* ---------------- */
|
|
|
|
|
$uidz = Db::getValue('select if(inUser > 0, inUser, id) as id from users where login = ? and battle = ?', [$_POST['smn'], $u->info['battle']]);
|
|
|
|
|
|
|
|
|
|
$rsm = $btl->smena($uidz);
|
|
|
|
|
if ($rsm != 1) {
|
|
|
|
|
echo $error($rsm);
|
2022-06-06 21:30:34 +00:00
|
|
|
|
}
|
2023-11-02 13:57:39 +00:00
|
|
|
|
unset($rsm);
|
|
|
|
|
$js .= 'smena_login = \'none\';';
|
2022-08-25 11:23:36 +00:00
|
|
|
|
}
|
|
|
|
|
|
2023-11-02 13:57:39 +00:00
|
|
|
|
//авто-смена
|
|
|
|
|
if (
|
|
|
|
|
$u->info['enemy'] == 0 ||
|
|
|
|
|
$btl->stats[$btl->uids[$u->info['enemy']]]['hpNow'] <= 0 ||
|
|
|
|
|
isset($btl->ga[$u->info['id']][$u->info['enemy']])
|
|
|
|
|
) {
|
|
|
|
|
$btl->autoSmena();
|
2022-08-25 11:23:36 +00:00
|
|
|
|
}
|
2023-11-02 13:57:39 +00:00
|
|
|
|
}
|
2022-06-06 21:30:34 +00:00
|
|
|
|
|
2023-11-02 13:57:39 +00:00
|
|
|
|
//получаем данные о поединке
|
2022-06-06 21:30:34 +00:00
|
|
|
|
|
2023-11-02 13:57:39 +00:00
|
|
|
|
//получаем данные о логе боя
|
2022-06-06 21:30:34 +00:00
|
|
|
|
|
2023-11-02 13:57:39 +00:00
|
|
|
|
//Если бой сыгран - завершаем
|
|
|
|
|
if (!isset($_POST['usepriem'])) {
|
|
|
|
|
$btl->testFinish();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ($btl->info['team_win'] == -1) {
|
|
|
|
|
$js .= $btl->genTeams($u->info['id']);
|
|
|
|
|
} else {
|
|
|
|
|
$btl->mainStatus = 3;
|
|
|
|
|
$btl->e = $u->btl_txt;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ($btl->info['id'] == $u->info['lider']) {
|
|
|
|
|
$js .= '$("#btn_down_img3").show();$("#btn_down_img4").show();';
|
|
|
|
|
} else {
|
|
|
|
|
$js .= '$("#btn_down_img3").hide();$("#btn_down_img4").hide();';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!isset($CRON_CORE)) {
|
|
|
|
|
$js .= $btl->myInfo($u->info['id'], 1);
|
|
|
|
|
|
|
|
|
|
//выводим данные
|
|
|
|
|
if ($btl->e != '') {
|
|
|
|
|
echo $error($btl->e);
|
2022-08-25 11:23:36 +00:00
|
|
|
|
}
|
2023-11-02 13:57:39 +00:00
|
|
|
|
|
|
|
|
|
if (
|
|
|
|
|
isset($btl->ga[$u->info['id']][$u->info['enemy']]) &&
|
|
|
|
|
$u->info['hpNow'] >= 1
|
|
|
|
|
) {
|
|
|
|
|
$btl->mainStatus = 2;
|
|
|
|
|
} elseif (
|
|
|
|
|
$u->info['enemy'] != 0 &&
|
|
|
|
|
$btl->info['team_win'] == -1 &&
|
|
|
|
|
$u->info['hpNow'] >= 1
|
|
|
|
|
) {
|
|
|
|
|
$js .= $btl->myInfo($u->info['enemy'], 2);
|
2022-08-25 11:23:36 +00:00
|
|
|
|
}
|
2022-06-06 21:30:34 +00:00
|
|
|
|
|
2023-11-02 13:57:39 +00:00
|
|
|
|
if ($btl->info['izlom'] > 0) {
|
|
|
|
|
$js .= 'volna(' . (1 + $btl->info['izlomRoundSee']) . ');';
|
2022-08-25 11:23:36 +00:00
|
|
|
|
}
|
2022-06-06 21:30:34 +00:00
|
|
|
|
|
2023-11-02 13:57:39 +00:00
|
|
|
|
$i = 1;
|
|
|
|
|
while ($i <= 7) {
|
|
|
|
|
if ($btl->users[$btl->uids[$u->info['id']]]['tactic' . $i] < 0) {
|
|
|
|
|
$btl->users[$btl->uids[$u->info['id']]]['tactic' . $i] = 0;
|
2022-06-06 21:30:34 +00:00
|
|
|
|
}
|
2023-11-02 13:57:39 +00:00
|
|
|
|
if ($btl->users[$btl->uids[$u->info['id']]]['tactic' . $i] > 25 && $i < 7) {
|
|
|
|
|
$btl->users[$btl->uids[$u->info['id']]]['tactic' . $i] = 25;
|
2022-08-25 11:23:36 +00:00
|
|
|
|
}
|
2023-11-02 13:57:39 +00:00
|
|
|
|
$i++;
|
2022-08-25 11:23:36 +00:00
|
|
|
|
}
|
2022-06-06 21:30:34 +00:00
|
|
|
|
|
|
|
|
|
|
2023-11-02 13:57:39 +00:00
|
|
|
|
$js .= '$("#priems").html("' . $priem->seeMy(2) . '");';
|
|
|
|
|
$jslog = $btl->lookmLog() . $btl->lookLog();
|
|
|
|
|
if ($jslog != '') {
|
|
|
|
|
$js = $jslog . $js;
|
|
|
|
|
}
|
|
|
|
|
unset($jslog);
|
|
|
|
|
|
|
|
|
|
$atk1 = isset($btl->ga[$u->info['enemy']][$u->info['id']]) ? 1 : 0;
|
|
|
|
|
$nabito = floor($btl->users[$btl->uids[$u->info['id']]]['battle_yron']);
|
|
|
|
|
$expmaybe = floor($btl->users[$btl->uids[$u->info['id']]]['battle_exp']);
|
|
|
|
|
$tmr = round(($btl->info['timeout'] / 60), 2);
|
|
|
|
|
$persMagic = $u->btlMagicList();
|
|
|
|
|
$za = (int)$btl->stats[$btl->uids[$u->info['id']]]['zona'];
|
|
|
|
|
$zb = (int)$btl->testZonbVis();
|
|
|
|
|
$tactic1 = (int)$btl->users[$btl->uids[$u->info['id']]]['tactic1'];
|
|
|
|
|
$tactic2 = (int)$btl->users[$btl->uids[$u->info['id']]]['tactic2'];
|
|
|
|
|
$tactic3 = (int)$btl->users[$btl->uids[$u->info['id']]]['tactic3'];
|
|
|
|
|
$tactic4 = (int)$btl->users[$btl->uids[$u->info['id']]]['tactic4'];
|
|
|
|
|
$tactic5 = (int)$btl->users[$btl->uids[$u->info['id']]]['tactic5'];
|
|
|
|
|
$tactic6 = (int)$btl->users[$btl->uids[$u->info['id']]]['tactic6'];
|
|
|
|
|
$tactic7 = (int)$btl->users[$btl->uids[$u->info['id']]]['tactic7'];
|
|
|
|
|
$smnpty = (int)$u->info['smena'];
|
|
|
|
|
$mainstatus = $btl->mainStatus;
|
|
|
|
|
$ggcode = PassGen::new();
|
|
|
|
|
|
|
|
|
|
echo <<<HTML
|
|
|
|
|
<script>
|
|
|
|
|
eatk = $atk1;
|
|
|
|
|
$('#nabito').html('$nabito');
|
|
|
|
|
$('#expmaybe').html('$expmaybe');
|
|
|
|
|
$('#timer_out').html('$tmr');
|
|
|
|
|
$('#pers_magic').html('$persMagic');
|
|
|
|
|
g_iCount = 30;
|
|
|
|
|
noconnect = 15;
|
|
|
|
|
connect = 1;
|
|
|
|
|
$('#go_btn').show();
|
|
|
|
|
$('#reflesh_btn').show();
|
|
|
|
|
za = '$za'; genZoneAtack();
|
|
|
|
|
zb = '$zb'; genZoneBlock();
|
|
|
|
|
refleshPoints();
|
|
|
|
|
tactic(1,'$tactic1');
|
|
|
|
|
tactic(2,'$tactic2');
|
|
|
|
|
tactic(3,'$tactic3');
|
|
|
|
|
tactic(4,'$tactic4');
|
|
|
|
|
tactic(5,'$tactic5');
|
|
|
|
|
tactic(6,'$tactic6');
|
|
|
|
|
smnpty='$smnpty';
|
|
|
|
|
mainstatus('$mainstatus')
|
|
|
|
|
tactic(7,'$tactic7');
|
|
|
|
|
smena_alls = '0';
|
|
|
|
|
ggcode='$ggcode';
|
|
|
|
|
$js
|
|
|
|
|
</script>
|
|
|
|
|
HTML;
|
|
|
|
|
|
|
|
|
|
if ($btl->cached) {
|
|
|
|
|
$btl->clear_cache_start();
|
2022-06-06 21:30:34 +00:00
|
|
|
|
}
|
2022-08-25 11:23:36 +00:00
|
|
|
|
|
2023-11-02 13:57:39 +00:00
|
|
|
|
unset($atk1);
|
2022-06-06 21:30:34 +00:00
|
|
|
|
}
|
2023-11-02 13:57:39 +00:00
|
|
|
|
echo '<script>ggcode="' . PassGen::new() . '";if(t057!=null){clearTimeout(t057);}</script>';
|
|
|
|
|
|
2022-06-06 21:30:34 +00:00
|
|
|
|
}
|