From 70389921ea781c55373bec1403eb7c01b123617c Mon Sep 17 00:00:00 2001 From: Ivor Barhansky Date: Tue, 3 Dec 2024 23:54:41 +0200 Subject: [PATCH] =?UTF-8?q?=D0=97=D0=B0=D0=BC=D0=BE=D1=80=D0=BE=D0=B7?= =?UTF-8?q?=D0=BA=D0=B0=20=D1=84=D0=B8=D0=BA=D1=81=D0=BE=D0=B2.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- _incl_data/class/Battle.php | 11 ++-- js/btl_mini.js | 114 +++++++++++++++--------------------- js/onlineList.js | 13 +--- jx/battle/refresh.php | 21 +++---- modules_data/btl_.php | 17 ++---- 5 files changed, 70 insertions(+), 106 deletions(-) diff --git a/_incl_data/class/Battle.php b/_incl_data/class/Battle.php index 038581dc..913e2cd5 100644 --- a/_incl_data/class/Battle.php +++ b/_incl_data/class/Battle.php @@ -1524,13 +1524,14 @@ JS; $jstext = json_encode($log['text']); $jsvars = json_encode($log['vars']); - $js = "add_log({$log['id']},0,$jstext,{$log['id_hod']},0,0,$jsvars)" . $js; + $js = "add_log({$log['id']},0,$jstext,{$log['id_hod']},$jsvars);" . $js; } Db::sql('update stats set alog = ? where id = ?', [$u->info['alog'], $u->info['id']]); $js .= "id_log=$pll;"; - return htmlspecialchars($js, ENT_QUOTES); + //return htmlspecialchars($js, ENT_QUOTES); + return $js; } @@ -1588,13 +1589,15 @@ JS; $jstext = json_encode($log['text']); $jsvars = json_encode($log['vars']); - $js = "add_mlog({$log['id']},0,$jstext,{$log['id_hod']},0,0,$jsvars)" . $js; + //$js = "add_mlog({$log['id']},0,$jstext,{$log['id_hod']},$jsvars);" . $js; + $js = "add_mlog({$log['id']},0,'{$log['text']}',{$log['id_hod']},'{$log['vars']}');" . $js; } Db::sql('update stats set mlog = ? where id = ?', [$u->info['mlog'], $u->info['id']]); $js .= "id_mlog=$pll;"; - return htmlspecialchars($js, ENT_QUOTES); + //return htmlspecialchars($js, ENT_QUOTES); + return $js; } //Считаем урон diff --git a/js/btl_mini.js b/js/btl_mini.js index 37d3f1b8..7f281aa6 100644 --- a/js/btl_mini.js +++ b/js/btl_mini.js @@ -22,9 +22,6 @@ var eatk = 0; var ggcode = '2014'; var irn = 0; -function magic_div(id, name, img, title) { - -} function testClearZone() { if (top.slcbrc[4] == 0) { @@ -81,8 +78,8 @@ function change_radioKeys(id, cper) { jo = 0; while (j <= 5) { var radio = document.getElementById(`atack_${i}_${j}`); - if (radio != undefined) { - if (radio.className != null && radio.className == "radio_on") jo++; + if (radio) { + if (radio.className && radio.className == "radio_on") jo++; } j++; } @@ -97,8 +94,8 @@ function change_radioKeys(id, cper) { var i = 1, jo = 0; while (i <= 5) { var radio = document.getElementById(`block_1_${i}`); - if (radio != undefined) { - if (radio.className != null && radio.className == "radio_on") jo++; + if (radio) { + if (radio.className && radio.className == "radio_on") jo++; } i++; } @@ -108,7 +105,7 @@ function change_radioKeys(id, cper) { } } - if ((z == 0 || id == 0) && cper == false) { + if ((z == 0 || id == 0) && !cper) { all_radio_off(); refleshPoints(); } @@ -203,7 +200,7 @@ function select_atack(id, r) { function radio_off(id, zone, type) { var i = 1; while (i <= 5) { - if (document.getElementById(`${type}_${id}_${i}`) != undefined && i != zone) { + if (document.getElementById(`${type}_${id}_${i}`) && i != zone) { document.getElementById(`${type}_${id}_${i}`).className = "radio_off"; if (type == 'atack') zas[id] = 0; else zbs[id] = 0; @@ -297,13 +294,13 @@ function autobattle() { var i = 1; while (i <= za) { if (zas[i] == 0 || top.slcbrc[4] === 1) { - zas[i] = Math.floor(Math.random(5) * 5 + 1); + zas[i] = Math.floor(Math.random() * 5 + 1); change_radio(i, zas[i], 'atack', 1); } i++; } if (zbs[1] == 0 || top.slcbrc[4] === 1) { - zbs[1] = Math.floor(Math.random(5) * 5 + 1); + zbs[1] = Math.floor(Math.random() * 5 + 1); change_radio(1, zbs[1], 'block', 1); } } @@ -343,7 +340,6 @@ async function atack() { } -var g_iCount = Number(); var g_iCount = 45; var tmr0057 = null; @@ -358,17 +354,17 @@ function startCountdown() { return tmr0057 = setTimeout('startCountdown()', 1000); } -var img_battle = ``; +let img_battle = `Battle`; function mainstatus(id) { if (smnpty <= 0) { - $('#btn_down_img2').css({'display': 'none'}); + document.getElementById('btn_down_img2').style.display = 'none'; } else { - $('#btn_down_img2').css({'display': ''}); - $('#btn_down_img2').attr('title', `Смена противника (${smnpty})`); + document.getElementById('btn_down_img2').style.display = ''; + document.getElementById('btn_down_img2').title = `Смена противника (${smnpty})` } - if (battleFinishData != -1) { // хуй знает че такое + if (battleFinishData !== -1) { // Объявляется аж в Finish.php document.getElementById('mainpanel2').style.display = ''; // 4 document.getElementById('go_btn').style.display = 'none'; // 4 document.getElementById('mainpanel').style.display = 'none'; // 4 @@ -379,11 +375,13 @@ function mainstatus(id) { document.getElementById('btn_down_img1').style.display = ''; // 2 document.getElementById('btn_down_img2').style.display = 'none'; // 2 - document.getElementById("ref").innerHTML = `
${battleFinishData}
`; + document.getElementById('ref').style.textAlign = 'center'; + document.getElementById('ref').style.color = 'red'; + document.getElementById("ref").innerHTML = `${battleFinishData}`; rand_img(); - document.getElementById("player2").innerHTML = `
${img_battle}
`; + document.getElementById("player2").innerHTML = `
${img_battle}
`; document.getElementById('player2_login').style.display = 'none'; - } else if (id == 1) //Можно ударить противника ( доступный удар ) + } else if (id === 1) //Можно ударить противника ( доступный удар ) { document.getElementById('mainpanel').style.display = ''; // 4 document.getElementById('player2_login').style.display = ''; @@ -394,10 +392,10 @@ function mainstatus(id) { document.getElementById('go_btn').setAttribute("class", "buttons btnnew btnnew2"); document.getElementById('go_btn').setAttribute("onclick", "atackt();"); - if (document.getElementById('reflesh_btn') != undefined) { + if (document.getElementById('reflesh_btn')) { document.getElementById('reflesh_btn').style.display = 'none'; } - } else if (id == 2) //Ожидаем хода противника ( обновить ) + } else if (id === 2) //Ожидаем хода противника ( обновить ) { document.getElementById('mainpanel').style.display = 'none'; // 4 document.getElementById('mainpanel222').style.display = 'none'; // 4 @@ -405,12 +403,12 @@ function mainstatus(id) { document.getElementById('go_btn').style.display = 'none'; // 4 document.getElementById('reflesh_btn').style.display = ''; // 3 rand_img(); - document.getElementById("player2").innerHTML = `
${img_battle}
`; + document.getElementById("player2").innerHTML = `
${img_battle}
`; document.getElementById('player2_login').style.display = 'none'; document.getElementById('btn_down_img1').setAttribute("onclick", "reflesht();"); document.getElementById('reflesh_btn').setAttribute("class", "buttons btnnew btnnew2"); document.getElementById('reflesh_btn').setAttribute("onclick", "reflesht();"); - } else if (id == 3) // Проиграли. Ожидаем завершения поединка ( кнопка вернутся с поединка ) + } else if (id === 3) // Проиграли. Ожидаем завершения поединка ( кнопка вернутся с поединка ) { document.getElementById('mainpanel2').style.display = ''; // 4 document.getElementById('go_btn').style.display = 'none'; // 4 @@ -426,104 +424,94 @@ function mainstatus(id) { document.getElementById('btn_down_img1').style.display = ''; // 2 document.getElementById('btn_down_img2').style.display = 'none'; // 2 - document.getElementById("ref").innerHTML = "Вы повержены. Ожидайте пока поединок завершат другие бойцы..."; - document.getElementById("player2").innerHTML = `
${img_battle}
`; + document.getElementById("ref").innerHTML = `Вы повержены. Ожидайте пока поединок завершат другие бойцы...`; + document.getElementById("player2").innerHTML = `
${img_battle}
`; document.getElementById('player2_login').style.display = 'none'; } - if (document.getElementById('mainpanel').style.display == '') { + if (document.getElementById('mainpanel').style.display !== 'none') { document.getElementById('mainpanel2').style.display = 'none'; } top.goSit(1); } function rand_img() { - if (level < 4) { - img_battle = ``; - return - } - img_battle = ``; + img_battle = `Battle`; } -var fstlh = 0; +let fstlh = 0; var lsti = 0; -var lsthd = []; +let lsthd = []; var id_log_ar = []; var id_log; var type_log = top.type_log; -function add_log(id, foryou, text, hod_id, my, last_hod, vars) { - if (top.des == 1) type_log = 0 +function add_log(id, foryou, text, hod_id, vars) { + if (top.des === 1) type_log = 0 else type_log = 1; - - if (type_log == 1) { - chsee = 'chsee2'; - if (my == 1) chsee = 'chsee3' - //if(id_log_ar[id]!=id) - //{ + if (type_log === 1) { text = looklogrep(text, vars); id_log_ar[id] = id; id_log = id; - // if (top.frames['main'].document.getElementById("battle_log_" + hod_id + "") == undefined && hod_id != 1) { - if (!top.frames['main'].document.getElementById(`battle_log_${hod_id}`) && hod_id != 1) { - if (fstlh == 0) fstlh = hod_id + + if (!top.frames['main'].document.getElementById(`battle_log_${hod_id}`) && hod_id !== 1) { + if (fstlh === 0) fstlh = hod_id lsthd[lsti] = hod_id; lsti++; $(top.frames['main'].document.getElementById('battle_logg')).prepend(`
`); } else if (!top.frames['main'].document.getElementById(`battle_log_${hod_id}`)) { - top.frames['main'].document.getElementById('battle_logg').innerHTML = top.frames['main'].document.getElementById('battle_logg').innerHTML + `
`; + top.frames['main'].document.getElementById('battle_logg').innerHTML += `
`; } if (!top.frames['main'].document.getElementById(`log_id_${id}`)) { $(top.frames['main'].document.getElementById(`battle_log_${hod_id}`)).prepend(`${text}
`); } - //} - if (top.frames['main'].document.getElementById(`battle_log_${hod_id - 25}`) != undefined) { + + if (top.frames['main'].document.getElementById(`battle_log_${hod_id - 25}`)) { top.rmve(`#battle_log_${hod_id - 25}`); } return } - chsee = 'chsee2'; - if (my == 1) chsee = 'chsee3' + + text = looklogrep(text, vars); id_log_ar[id] = id; id_log = id; - if (!top.document.getElementById(`battle_log_${hod_id}`) && hod_id != 1) { - if (fstlh == 0) { + if (!top.document.getElementById(`battle_log_${hod_id}`) && hod_id !== 1) { + if (fstlh === 0) { fstlh = hod_id; } lsthd[lsti] = hod_id; lsti++; $(top.document.getElementById('battle_logg')).prepend(`
`); - } else if (top.document.getElementById("battle_log_" + hod_id + "") == undefined) { - top.document.getElementById('battle_logg').innerHTML = top.document.getElementById('battle_logg').innerHTML + `
`; + } else if (!top.document.getElementById("battle_log_" + hod_id)) { + top.document.getElementById('battle_logg').insertAdjacentHTML('beforeend', `
`); } if (!top.document.getElementById(`log_id_${id}`)) { $(top.document.getElementById(`battle_log_${hod_id}`)).prepend(`${text}
`); } - if (top.document.getElementById(`battle_log_${hod_id - 7}`) != undefined) { + if (top.document.getElementById(`battle_log_${hod_id - 7}`)) { top.rmve(`#battle_log_${hod_id - 7}`); } } //-- Мой лог-------------------------------- //------------------------------------------- -function add_mlog(id, foryou, text, hod_id, my, last_hod, vars) { - chsee = 'chsee7'; +function add_mlog(id, foryou, text, hod_id, vars) { text = looklogrep(text, vars); id_log_ar[id] = id; id_log = id; - if (!top.document.getElementById(`battle_mlog_${hod_id}`) && hod_id != 1) { + if (!top.document.getElementById(`battle_mlog_${hod_id}`) && hod_id !== 1) { $(top.document.getElementById('battle_mlogg')).prepend(`
`); } else if (!top.document.getElementById(`battle_mlog_${hod_id}`)) { - top.document.getElementById('battle_mlogg').innerHTML = top.document.getElementById('battle_mlogg').innerHTML + `
`; + top.document.getElementById('battle_mlogg').innerHTML += `
`; } if (!top.document.getElementById(`mlog_id_${id}`)) { $(top.document.getElementById(`battle_mlog_${hod_id}`)).prepend(`${text}
`); } - if (top.document.getElementById(`battle_mlog_${hod_id - 14}`) != undefined) { + if (top.document.getElementById(`battle_mlog_${hod_id - 14}`)) { top.rmve(`#battle_mlog_${hod_id - 14}`); } } @@ -578,9 +566,3 @@ function usePriem(id) { priem_use = id; if (id != 0) reflesh() } - -//document.onkeydown=key; -function key() { - //window.status=event.keyCode; - //if(event.keyCode==13){ atack(); } -} \ No newline at end of file diff --git a/js/onlineList.js b/js/onlineList.js index d8b34fca..efcbf51b 100644 --- a/js/onlineList.js +++ b/js/onlineList.js @@ -42,7 +42,6 @@ const chat = { efftxt: function (id, txt) { return txt; }, - ignore: function (login) { if (this.ignoreList[login] !== undefined) { if ($('#ignr_alu').attr('id') !== undefined) { @@ -64,13 +63,10 @@ const chat = { ingr_alu.html(`${ingr_alu.html()}
${login} Инф. о ${login} Clear
`); } }, - getRandom: function (a, b) { return a + ((b - a) * Math.random()); }, - feerverk_id: 0, - feerverk: function (name) { const frc = { 'name': 'fw04', @@ -86,7 +82,7 @@ const chat = { frc.left -= 35; } - if (frc.name) { + if (frc.name !== undefined) { const obj = top.frames.main.document.getElementById('frvrks'); if (obj !== undefined) { let newhtml = ''; @@ -106,7 +102,6 @@ const chat = { if (zad > 0) { setTimeout(`chat.feerverk_go(${id}, ${time_back}, "${img}", ${x}, 0);`, 500 * zad); } else { - time_back--; top.frames.main.document.getElementById(`frvanim_${id}`); if (time_back > 0) { @@ -262,12 +257,10 @@ const chat = { clearText: function () { $('#textmsg').val(''); }, - reflesh: function () { this.time = 0; this.testTimer(true); }, - reMoney: function () { $('#moneyGM').html(`${c.money} кр.`); }, @@ -275,13 +268,13 @@ const chat = { clearTimeout(this.t); if ($.cookie('btl') !== this.btl) { if ($.cookie('btl') > 0) { - if (!top.frames['main'].smnpty) { + if (top.frames['main'].smnpty === undefined) { top.frames['main'].location.href = "main.php"; } } this.btl = $.cookie('btl'); } - if (this.rtime !== this.ct[$.cookie('chatCfg0')] && this.ct[$.cookie('chatCfg0')]) { + if (this.rtime !== this.ct[$.cookie('chatCfg0')] && this.ct[$.cookie('chatCfg0')] !== undefined) { this.rtime = this.ct[$.cookie('chatCfg0')]; if (this.time > this.rtime) this.time = this.rtime; } diff --git a/jx/battle/refresh.php b/jx/battle/refresh.php index 1beac82f..f8379bc9 100644 --- a/jx/battle/refresh.php +++ b/jx/battle/refresh.php @@ -3,16 +3,18 @@ use Core\Config; use Core\Db; -session_start(); +//session_start(); $tm = microtime(true); if (!isset($CRON_CORE)) { - require_once('../../_incl_data/__config.php'); + require_once dirname(__DIR__,2) . DIRECTORY_SEPARATOR . '_incl_data/autoload.php'; + //require_once '../../_incl_data/__config.php'; } if (!isset($CRON_CORE)) { - define('GAME', true); - require_once('../../_incl_data/class/__db_connect.php'); + //define('GAME', true); + require_once dirname(__DIR__,2) . DIRECTORY_SEPARATOR . '_incl_data/class/__db_connect.php'; + //require_once('../../_incl_data/class/__db_connect.php'); } function e($t): void @@ -207,12 +209,6 @@ if (!$isBattle) { $i++; } - $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']); @@ -232,8 +228,10 @@ if (!$isBattle) { $ggcode = PassGen::new(); $mypriems = $priem->seeMy(); + $logs = $btl->lookmLog() . $btl->lookLog(); echo << + $logs eatk = $atk1; $('#nabito').html('$nabito'); $('#expmaybe').html('$expmaybe'); @@ -259,10 +257,7 @@ if (!$isBattle) { tactic(7,'$tactic7'); smena_alls = '0'; ggcode='$ggcode'; - - $js - HTML; diff --git a/modules_data/btl_.php b/modules_data/btl_.php index 975e8cec..8ee0dd90 100644 --- a/modules_data/btl_.php +++ b/modules_data/btl_.php @@ -1050,18 +1050,9 @@ $allprice = Battle::getType($allprice, $thisBattle['smert'] == 1);
- - - - - - -
  -
-
Полную версию лога боя смотрите здесь »»
-
 
+
+
Полную версию лога боя смотрите здесь »»
+
@@ -1134,5 +1125,5 @@ $allprice = Battle::getType($allprice, $thisBattle['smert'] == 1); + include('jx/battle/refresh.php'); ?>