diff --git a/_incl_data/class/Battle.php b/_incl_data/class/Battle.php index 038581dc..fc683ae5 100644 --- a/_incl_data/class/Battle.php +++ b/_incl_data/class/Battle.php @@ -247,7 +247,7 @@ class Battle /** * @param int|null $experience - * @param bool $hardcore поединок с гарантированной травмой + * @param bool $hardcore поединок с гарантированной травмой * @return array|int[] */ public static function getType(?int $experience, bool $hardcore = false): array @@ -365,10 +365,10 @@ class Battle Db::sql( 'update stats set last_hp = ?, tactic7 = ? where id = ?', [ - $this->users[$this->uids[$uid]]['last_hp'], - $this->users[$this->uids[$uid]]['tactic7'], - $uid, - ] + $this->users[$this->uids[$uid]]['last_hp'], + $this->users[$this->uids[$uid]]['tactic7'], + $uid, + ] ); return (int)$hp; @@ -1139,9 +1139,9 @@ JS; /** * @param array $botLogins - * @param int $counter - * @param int $obr - * @param int $unique для совместимости с непонятным вызовом User->addAction + * @param int $counter + * @param int $obr + * @param int $unique для совместимости с непонятным вызовом User->addAction * при вызове уникального монстра. * @return void */ @@ -1231,14 +1231,14 @@ JS; /** Осторожно! Подключаются файлы!!! * Трогать очень осторожно. Этот шайтан как-то проверяет приёмы на враге * и рассчитывает урон учитывая и эти приёмы тоже. - * @param int $uid1 - * @param int $uid2 - * @param int $priem + * @param int $uid1 + * @param int $uid2 + * @param int $priem * @param $yron - * @param int $profil + * @param int $profil * @param bool $stabil * @param bool $test - * @param int $inlog + * @param int $inlog * @return float|int|mixed */ public function testYronPriem( @@ -1250,7 +1250,8 @@ JS; bool $stabil, bool $test = false, int $inlog = 0 - ): mixed { + ): mixed + { /** * profil = { @@ -1524,7 +1525,7 @@ 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']},$jstext,{$log['id_hod']},$jsvars)" . $js; } Db::sql('update stats set alog = ? where id = ?', [$u->info['alog'], $u->info['id']]); @@ -1588,7 +1589,7 @@ 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']},$jstext,{$log['id_hod']},$jsvars)" . $js; } Db::sql('update stats set mlog = ? where id = ?', [$u->info['mlog'], $u->info['id']]); @@ -1917,17 +1918,6 @@ JS; } } - /** - * Массово встречается в подключаемых файлах приёмов. - * @param array $arr - * @return void - * @deprecated - */ - public function add_log(array $arr): void - { - Log::add($arr); - } - private function botAtack($uid, $pl, $tp): void { $testAttack = Db::getValue('select count(id) from battle_act where battle = ? and uid1 in (?,?) and uid2 in(?,?) and uid1 != uid2', [$this->i->id, $pl, $uid, $pl, $uid]) === 0; @@ -1960,8 +1950,6 @@ JS; } } - //Используем приемы - public function startAtack($id): void { global $u, $priem; @@ -2410,12 +2398,14 @@ JS; Db::sql('delete from battle_act where id = ?', [$id]); } + //Используем приемы + /** Осторожно! Подключаются файлы!!! - * @param array $pl + * @param array $pl * @param $u1 - * @param int $t + * @param int $t * @param int|array $u2 - * @param string $rznm + * @param string $rznm * @return void */ public function delPriem( @@ -2424,7 +2414,8 @@ JS; int $t = 1, int|array $u2 = 0, string $rznm = 'Очиститься Кровью' - ): void { + ): void + { global $u, $priem; if (!isset($pl['priem']['id']) || isset($this->del_val['eff'][$pl['priem']['id']])) { return; @@ -2481,8 +2472,6 @@ JS; $this->stats[$this->uids[$pl['uid']]] = $u->getStats($pl['uid'], 0, 0, false, false, true); } - //Повторная проверка приемов - /** * Расчет количества блоков и противников? * @param $uid @@ -2561,7 +2550,7 @@ JS; } } - //Проверка действия приема + //Повторная проверка приемов /** * Магия предметов? @@ -2594,7 +2583,7 @@ JS; } } - //Проверка урона приемов + //Проверка действия приема private function newRazmen($id): array { @@ -2615,6 +2604,8 @@ JS; return $at; } + //Проверка урона приемов + private function usersTestAtack($id, $uid1, $uid2): array { $r = []; @@ -2678,8 +2669,6 @@ JS; return $r; } - //Наносим удар между игроками - public function priemsRazmen(array|int $id, array|string $at): void { if ($at == 'fast') { @@ -2731,6 +2720,8 @@ JS; } } + //Наносим удар между игроками + /** Осторожно! Подключаются файлы!!! * @param $id * @param $at @@ -2952,10 +2943,6 @@ JS; return $at; } - - //Расчет типа удара от оружия - //Расчет урона от оружия - public function testPogB($uid, $yr, $pliid, $test = 0) { $checktuman = Db::getValue('select count(id) from eff_users where uid = ? and v2 in (273,286,287,288)', [$uid]) == 0; //проверка на туманный образ @@ -3056,6 +3043,8 @@ JS; return $yr2; } + + //Расчет типа удара от оружия //Расчет урона от оружия /** @@ -3223,8 +3212,7 @@ JS; return $at; } - - //Расчет защиты + //Расчет урона от оружия public function yhod_user($uid1, $uid2, $type) { @@ -3285,7 +3273,8 @@ JS; return $r; } - //Расчет защиты (магия) + + //Расчет защиты /** * Добавляем опыт \ нанесенный урон. @@ -3444,6 +3433,8 @@ JS; } } + //Расчет защиты (магия) + private function clearCache($uid): void { if ($uid <= 0 || isset($this->uclearc[$uid])) { @@ -3868,7 +3859,6 @@ JS; return '{' . $a . 'x' . $id . 'x' . $rnd . '}'; } - /** * Свиток спасения. * @@ -3995,7 +3985,8 @@ JS; $hodID, $tm1 = 0, $tm2 = 0 - ): void { + ): void + { $time = time(); if ($tm1 == 0) { $tm1 = isset($this->atacks[$id]) ? $this->atacks[$id]['time'] : $time; @@ -4029,8 +4020,6 @@ JS; Log::add($mas); } - //Расчет МФ - /** * Возращаем зоны блока? * @param $uid1 @@ -4047,6 +4036,8 @@ JS; } } + //Расчет МФ + private function saveStats($uid): void { Stats::saveBattleStats($this->stats[$this->uids[$uid]], $uid); @@ -4117,8 +4108,6 @@ JS; return $result ?: []; } - //Действия бота (атака) - /** * Смерть от пропуска ходов. Включается в конфиге. * @param int $id @@ -4151,7 +4140,7 @@ JS; } } - //Проверяем удары, приемы, свитки, зверей + //Действия бота (атака) private function addNewAtack(User $u): void { @@ -4237,7 +4226,7 @@ JS; } - //Действия бота + //Проверяем удары, приемы, свитки, зверей private function botAct($uid): bool { @@ -4254,6 +4243,19 @@ JS; return $r; } + //Действия бота + + /** + * Массово встречается в подключаемых файлах приёмов. + * @param array $arr + * @return void + * @deprecated + */ + public function add_log(array $arr): void + { + Log::add($arr); + } + /** * Запись выбранных ударов и блоков в массив $this->uAtc. * Технически это сеттер. diff --git a/_incl_data/class/Priems.php b/_incl_data/class/Priems.php index 700d7230..417fb473 100644 --- a/_incl_data/class/Priems.php +++ b/_incl_data/class/Priems.php @@ -108,7 +108,7 @@ class Priems /** используем прием каждый ход * @param Battle $btl - * @param array $eff + * @param array $eff * @return bool */ public function hodUsePriem(Battle $btl, array $eff): bool @@ -466,11 +466,11 @@ class Priems /** * Новая функция магического заклинания с приёма. * Работает с числовыми приёмами в папке [priem]. - * @param int $attackerId кто использует приём - * @param int $defenderId на кого использует приём - * @param float $damage базовый урон приёма - * @param string $damageType тип урона (стихия?) приходит строкой, и конвертируется функцией. - * @param bool $hasCritical флаг, что приём МОЖЕТ критовать + * @param int $attackerId кто использует приём + * @param int $defenderId на кого использует приём + * @param float $damage базовый урон приёма + * @param string $damageType тип урона (стихия?) приходит строкой, и конвертируется функцией. + * @param bool $hasCritical флаг, что приём МОЖЕТ критовать * @return array [0|damage] int урон, [1|crit] bool был ли крит, [2|miss] bool был ли промах, [3|miss_type] int тип промаха (всегда = 2). * @author Insallah */ @@ -786,7 +786,8 @@ class Priems $krituet = true, $heal = 0, $namenew = null - ) { + ) + { $trawm_off = false; global $btl; if ($namenew != null) { @@ -965,8 +966,7 @@ class Priems ); //заносим в лог боя - $vLog = 'time1=' . time( - ) . '||s1=' . $btl->users[$btl->uids[$usu]]['sex'] . '||t1=' . $btl->users[$btl->uids[$usu]]['team'] . '||login1=' . $btl->users[$btl->uids[$usu]]['login'] . '||s2=' . $btl->users[$btl->uids[$uen]]['sex'] . '||t2=' . $btl->users[$btl->uids[$uen]]['team'] . '||login2=' . $btl->users[$btl->uids[$uen]]['login'] . ''; + $vLog = 'time1=' . time() . '||s1=' . $btl->users[$btl->uids[$usu]]['sex'] . '||t1=' . $btl->users[$btl->uids[$usu]]['team'] . '||login1=' . $btl->users[$btl->uids[$usu]]['login'] . '||s2=' . $btl->users[$btl->uids[$uen]]['sex'] . '||t2=' . $btl->users[$btl->uids[$uen]]['team'] . '||login2=' . $btl->users[$btl->uids[$uen]]['login'] . ''; $mas1 = [ 'time' => time(), 'battle' => $btl->i->id, @@ -1579,13 +1579,13 @@ class Priems } /** - * @param int $uid на кого кастуем - * @param int $pr id приема + * @param int $uid на кого кастуем + * @param int $pr id приема * @param int|string $data дата, если -1, то добавляем дату3 - * @param int $d2 + * @param int $d2 * @param $tm - * @param int $h ход - * @param int $uu id юзера который использовал + * @param int $h ход + * @param int $uu id юзера который использовал * @param $max * @param $bj * @param $tp @@ -1614,7 +1614,8 @@ class Priems $noupdatebtl = 0, $noplus = 0, $pname = null - ) { + ) + { global $btl; //$pl = mysql_fetch_assoc(mysql_query('SELECT * FROM `priems` WHERE `id` = ' . (int)$pr)); $pl = Db::getRow('select * from priems where id = ?', [$pr]); @@ -1732,8 +1733,8 @@ class Priems /** Получает строку data c шаблонной записью типа add_m11=2*{lvl1} и конвертирует в реальную строку. *
Шаблон:
lvl1 = $uid[level]
ts5 = $uid[s5]
mpAll = $uid[mpAll] - * @param string $pl строка в формате data - * @param int $uid пользователь, параметры которого используются для подставки в шаблон. + * @param string $pl строка в формате data + * @param int $uid пользователь, параметры которого используются для подставки в шаблон. * @return string строка в формате data с развёрнутыми шаблонами. */ public function redate($pl, $uid) @@ -1981,8 +1982,7 @@ class Priems } else { //бьем противника с пропуском хода mysql_query( - 'INSERT INTO `battle_act` (`battle`,`uid1`,`uid2`,`time`,`out1`,`type`,`tpo1`) VALUES ("' . $btl->i->id . '","' . $this->u->info['id'] . '","' . $this->u->info['enemy'] . '","' . time( - ) . '","1","1","2")' + 'INSERT INTO `battle_act` (`battle`,`uid1`,`uid2`,`time`,`out1`,`type`,`tpo1`) VALUES ("' . $btl->i->id . '","' . $this->u->info['id'] . '","' . $this->u->info['enemy'] . '","' . time() . '","1","1","2")' ); } } @@ -2086,11 +2086,11 @@ class Priems ); if ($upd) { TrainingManager::getInstance() - ->addPoint( - 'my_user_fourth_quest', function (TrainingManager $manager) { - $manager->store(); - } - ); + ->addPoint( + 'my_user_fourth_quest', function (TrainingManager $manager) { + $manager->store(); + } + ); $this->u->info['priems'] = $p; } } else { @@ -2172,7 +2172,7 @@ class Priems /** * Летит в js, двойные кавычки не использовать. * @param array $pl - * @param int $id + * @param int $id * @return array */ private function priemInfo(array $pl, int $id = -1): array @@ -2281,11 +2281,11 @@ class Priems $cl = 'href="javascript:void(0);" onClick="top.priemOnUser(' . $i . ',1,\'' . $pl['name'] . '\',\'' . $oninuser . '\',\'' . $pl['img'] . '\');"'; unset($oninuser); } else { - $cl = 'href="javascript:void(0);" onClick="usepriem(' . $i . ',1,\'' . $pl['img'] . '\');"'; + $cl = 'href="javascript:void(0);" onClick="usepriem(' . $i . ');"'; } } elseif ($pl['type'] == 2) { //длительное - $cl = 'href="javascript:void(0);" onClick="usepriem(' . $i . ',1,\'' . $pl['img'] . '\');"'; + $cl = 'href="javascript:void(0);" onClick="usepriem(' . $i . ');"'; } elseif ($pl['type'] == 3) { $cl = 'href="javascript:void(0);" onClick="alert(\'Возможно используем?\');"'; } @@ -2328,7 +2328,7 @@ class Priems 1 ); if (!isset($use_lst['id'])) { - $pr .= ''; + $pr .= ''; } else { $pr .= ''; } @@ -2787,7 +2787,7 @@ class Priems * Конечный damage после множителей делится на 5 и пишется в БД (atgm=). * Файлы: 33, 56, 57, 58, 59, 60. * @param $id - * @param array $pl массив значений из БД priems. + * @param array $pl массив значений из БД priems. * @param Battle $btl * @return void */ @@ -2819,7 +2819,7 @@ class Priems * Если есть одинаковые статы из них выбирается случайный. * Файл:267, приём 268. Понимай как хочешь. * @param $id - * @param array $pl + * @param array $pl * @param Battle $btl * @return void */ diff --git a/js/btl_mini.js b/js/btl_mini.js index 37d3f1b8..5f1b5179 100644 --- a/js/btl_mini.js +++ b/js/btl_mini.js @@ -27,94 +27,90 @@ function magic_div(id, name, img, title) { } function testClearZone() { - if (top.slcbrc[4] == 0) { + if (top.slcbrc[4] === 0) { all_radio_off(); } } -async function usepriem(id, t, img) { - if (t == 1) { - irn++; +async function usepriem(id) { + irn++; + await $.post(`jx/battle/refresh.php?rnd=${ggcode}&irn=${irn}`, { + idlog: top.id_log, + usepriem: id, + useon: use_on_pers + }, function (data) { + $("#ref").html(data); + }); + use_on_pers = 'none'; + top.goSit(1); +} + +async function useitem(id, use_item_on) { + irn++; + if (top.c.noEr === 0) { + top.c.noEr = 1; + clearTimeout(top.c.noErTmr); + top.c.noErTmr = setTimeout('top.c.noEr = 0;', 1000); await $.post(`jx/battle/refresh.php?rnd=${ggcode}&irn=${irn}`, { idlog: top.id_log, - usepriem: id, - useon: use_on_pers + useitem: id, + useitemon: use_item_on }, function (data) { $("#ref").html(data); }); - use_on_pers = 'none'; - top.goSit(1); - return } - return alert('Not found'); -} - -async function useitem(id, t, use_item_on) { - if (t == 1) { - irn++; - if (top.c.noEr == 0) { - top.c.noEr = 1; - clearTimeout(top.c.noErTmr); - top.c.noErTmr = setTimeout('top.c.noEr = 0;', 1000); - await $.post(`jx/battle/refresh.php?rnd=${ggcode}&irn=${irn}`, { - idlog: top.id_log, - useitem: id, - useitemon: use_item_on - }, function (data) { - $("#ref").html(data); - }); - } - return top.goSit(1); - } - return alert('Not found'); + return top.goSit(1); } function volna(id) { document.getElementById('volna').innerHTML = `Волна: ${id}`; } -function change_radioKeys(id, cper) { - var z = 0, t = 0, k = 0; - var i = 1, j = 1; +function change_radioKeys(id = 0) { + let jo; + let radio; + let z = 0, t = ''; + let i = 1, j = 1; while (i <= za) { j = 1; jo = 0; while (j <= 5) { - var radio = document.getElementById(`atack_${i}_${j}`); - if (radio != undefined) { - if (radio.className != null && radio.className == "radio_on") jo++; + radio = document.getElementById(`atack_${i}_${j}`); + if (radio) { + if (radio.className != null && radio.className === "radio_on") jo++; } j++; } - if (jo == 0 && z == 0) { + if (jo === 0 && z === 0) { z = i; t = 'atack'; } i++; } - if (z == 0) { - var i = 1, jo = 0; + if (z === 0) { + 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++; + radio = document.getElementById(`block_1_${i}`); + if (radio) { + if (radio.className != null && radio.className === "radio_on") jo++; } i++; } - if (jo == 0 && z == 0) { + if (jo === 0 && z === 0) { z = 1; t = 'block'; } } - if ((z == 0 || id == 0) && cper == false) { + if (z === 0 || id === 0) { all_radio_off(); refleshPoints(); } if (z > 0) { - if (id == 0) { + if (id === 0) { //автовыставление } else change_radio(z, id, t, 1) } @@ -122,15 +118,15 @@ function change_radioKeys(id, cper) { function change_radio(id, zone, type, r) { radio_off(id, zone, type); - var radio = document.getElementById(`${type}_${id}_${zone}`); + const radio = document.getElementById(`${type}_${id}_${zone}`); - if (radio.className == "radio_on" && r == 0) { + if (radio.className === "radio_on" && r === 0) { radio.className = "radio_off"; - if (type == 'atack') zas[id] = 0; + if (type === 'atack') zas[id] = 0; else zbs[id] = 0; } else { radio.className = "radio_on"; - if (type == 'atack') zas[id] = zone; + if (type === 'atack') zas[id] = zone; else zbs[id] = zone; } refleshPoints(); @@ -142,17 +138,17 @@ function tactic(id, value) { function refleshPoints() { clearZone(); - var i = 5; + let i = 5; while (i >= 1) { - if (zas[i] == 0) lineAtack(i); + if (zas[i] === 0) lineAtack(i); i--; } - if (zbs[1] == 0) lineBlock(); + if (zbs[1] === 0) lineBlock(); } function lineAtack(id) { nos++; - var j = 1; + let j = 1; while (j <= 5) { document.getElementById(`zatack${id}_${j}`).className = 'zoneCh_yes'; j++; @@ -161,7 +157,7 @@ function lineAtack(id) { function lineBlock() { nos++; - var j = 1; + let j = 1; while (j <= 5) { document.getElementById(`zblock1_${j}`).className = 'zoneCh_yes'; j++; @@ -170,16 +166,16 @@ function lineBlock() { function clearZone() { nos = 0; - var i = 1; + let i = 1; while (i <= 5) { - var j = 1; + let j = 1; while (j <= 5) { document.getElementById(`zatack${i}_${j}`).className = 'zoneCh_no'; j++; } i++; } - var i = 1; + i = 1; while (i <= 5) { document.getElementById(`zblock1_${i}`).className = 'zoneCh_no'; i++; @@ -187,9 +183,9 @@ function clearZone() { } function select_atack(id, r) { - var i = 5; + let i = 5; while (i >= 1) { - if (zas[i] == 0) { + if (zas[i] === 0) { if (i <= za) sel_atack = i } i--; @@ -201,11 +197,11 @@ function select_atack(id, r) { } function radio_off(id, zone, type) { - var i = 1; + let 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; + if (type === 'atack') zas[id] = 0; else zbs[id] = 0; } i++; @@ -213,9 +209,9 @@ function radio_off(id, zone, type) { } function all_radio_off() { - var i = 1; + let i = 1; while (i <= 5) { - var j = 1; + let j = 1; while (j <= 5) { document.getElementById(`atack_${j}_${i}`).className = "radio_off"; j++; @@ -228,11 +224,11 @@ function all_radio_off() { } function genZoneBlock() { - var i = 1; + let i = 1; while (i <= 5) { - var j = 1; + let j = 1; while (j <= 3) { - if (j == zb) { + if (j === zb) { document.getElementById(`txtb${i}_${j}`).style.display = ''; } else { document.getElementById(`txtb${i}_${j}`).style.display = 'none'; @@ -244,9 +240,9 @@ function genZoneBlock() { } function genZoneAtack() { - var i = 1; + let i = 1; while (i <= 5) { - var j = 1; + let j = 1; while (j <= 5) { if (i <= za) { document.getElementById(`zatack${i}_${j}`).style.display = ''; @@ -263,16 +259,13 @@ function genteam(team) { document.getElementById('teams').innerHTML = team; } -var t057 = null; -var battle_end = 0; - -async function reflesh(bl) { +async function reflesh() { irn++; if (battleFinishData != -1) mainstatus(0); - if ((battle_end == 0 || bl != null) && battleFinishData == -1) { - if (top.c.noEr == 0) { + if (battleFinishData == -1) { + if (top.c.noEr === 0) { top.c.noEr = 1; clearTimeout(top.c.noErTmr); top.c.noErTmr = setTimeout('top.c.noEr = 0;', 1000); @@ -289,21 +282,21 @@ async function reflesh(bl) { $("#ref").html(data); }); } - if (g_iCount != 45) g_iCount = 45; + if (g_iCount !== 45) g_iCount = 45; } } function autobattle() { - var i = 1; + let i = 1; while (i <= za) { - if (zas[i] == 0 || top.slcbrc[4] === 1) { - zas[i] = Math.floor(Math.random(5) * 5 + 1); + if (zas[i] === 0 || top.slcbrc[4] === 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); + if (zbs[1] === 0 || top.slcbrc[4] === 1) { + zbs[1] = Math.floor(Math.random() * 5 + 1); change_radio(1, zbs[1], 'block', 1); } } @@ -343,25 +336,27 @@ async function atack() { } -var g_iCount = Number(); var g_iCount = 45; -var tmr0057 = null; +let tmr0057 = null; // 1.1 function startCountdown() { - if (tmr0057 != null) clearTimeout(tmr0057); + if (tmr0057 !== null) clearTimeout(tmr0057); if ((g_iCount - 1) >= 0) { g_iCount -= 1; - return tmr0057 = setTimeout('startCountdown()', 1000); + return tmr0057 = setTimeout(startCountdown, 1000); } reflesh(); - return tmr0057 = setTimeout('startCountdown()', 1000); + return tmr0057 = setTimeout(startCountdown, 1000); } -var img_battle = ``; +let img_battle = ``; function mainstatus(id) { + id = +id; + if (isNaN(id)) id = 0; + if (smnpty <= 0) { $('#btn_down_img2').css({'display': 'none'}); } else { @@ -383,7 +378,7 @@ function mainstatus(id) { rand_img(); 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 +389,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 @@ -410,7 +405,7 @@ function mainstatus(id) { 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 @@ -430,18 +425,14 @@ function mainstatus(id) { 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) { document.getElementById('mainpanel2').style.display = 'none'; } top.goSit(1); } function rand_img() { - if (level < 4) { - img_battle = ``; - return - } - img_battle = ``; + img_battle = ``; } var fstlh = 0; @@ -451,13 +442,13 @@ 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, text, hod_id, vars) { + if (top.des === 1) type_log = 0 else type_log = 1; - if (type_log == 1) { + if (type_log === 1) { chsee = 'chsee2'; - if (my == 1) chsee = 'chsee3' + //if(id_log_ar[id]!=id) //{ text = looklogrep(text, vars); @@ -465,7 +456,7 @@ function add_log(id, foryou, text, hod_id, my, last_hod, vars) { 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 (fstlh === 0) fstlh = hod_id lsthd[lsti] = hod_id; lsti++; $(top.frames['main'].document.getElementById('battle_logg')).prepend(`
`); @@ -474,40 +465,40 @@ function add_log(id, foryou, text, hod_id, my, last_hod, vars) { } if (!top.frames['main'].document.getElementById(`log_id_${id}`)) { - $(top.frames['main'].document.getElementById(`battle_log_${hod_id}`)).prepend(`${text}
`); + $(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 (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) { + } else if (!top.document.getElementById("battle_log_" + hod_id + "")) { top.document.getElementById('battle_logg').innerHTML = top.document.getElementById('battle_logg').innerHTML + `
`; } if (!top.document.getElementById(`log_id_${id}`)) { - $(top.document.getElementById(`battle_log_${hod_id}`)).prepend(`${text}
`); + $(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) { +function add_mlog(id, text, hod_id, vars) { chsee = 'chsee7'; text = looklogrep(text, vars); id_log_ar[id] = id; @@ -520,10 +511,10 @@ function add_mlog(id, foryou, text, hod_id, my, last_hod, vars) { } if (!top.document.getElementById(`mlog_id_${id}`)) { - $(top.document.getElementById(`battle_mlog_${hod_id}`)).prepend(`${text}
`); + $(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}`); } } @@ -551,36 +542,12 @@ function defPosition(event) { return {x: x, y: y}; } -function initMove(div, event) { - var event = event || window.event; - x0 = defPosition(event).x; - y0 = defPosition(event).y; - divX0 = parseInt(div.style.left); - divY0 = parseInt(div.style.top); - moveState = true; -} - document.onmouseup = function () { moveState = false; } -// И последнее -// Функция обработки движения: -function moveHandler(div, event) { - var event = event || window.event; - if (moveState) { - div.style.left = divX0 + defPosition(event).x - x0; - div.style.top = divY0 + defPosition(event).y - y0; - } -} function usePriem(id) { priem_use = id; - if (id != 0) reflesh() + if (id) 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/gameEngine.js b/js/gameEngine.js index 1b81e5f4..bfa874f7 100644 --- a/js/gameEngine.js +++ b/js/gameEngine.js @@ -950,7 +950,7 @@ function useMagicBattle(name, id, img, type, type_use, text, team) { // 4.26 function useMagicGoGoBattle(id) { - top.frames['main'].useitem(id, 1, $(`#useMagicLoginBtl${id}`).val()); + top.frames['main'].useitem(id, $(`#useMagicLoginBtl${id}`).val()); } /* Использовать предмет на */ @@ -1028,7 +1028,7 @@ function priemOnUser(pr, id, nm, onInUser, img) { // 4.32 function usePriemNow(id) { top.frames['main'].use_on_pers = $(`#usePriemLogin${id}`).val(); - top.frames['main'].usepriem(id, 1, ''); + top.frames['main'].usepriem(id); } var datas = ''; diff --git a/jx/battle/refresh.php b/jx/battle/refresh.php index 1beac82f..761006e6 100644 --- a/jx/battle/refresh.php +++ b/jx/battle/refresh.php @@ -272,6 +272,6 @@ HTML; unset($atk1); } - echo ''; + echo ''; } diff --git a/jx/battle/refresh1.php b/jx/battle/refresh1.php index 368e1c2c..ec4e84b5 100644 --- a/jx/battle/refresh1.php +++ b/jx/battle/refresh1.php @@ -252,5 +252,5 @@ if (!$isBattle) { unset($atk1); } - echo ''; + echo ''; } diff --git a/jx/battle/refresh2.php b/jx/battle/refresh2.php index 4152a5e6..b0de8f01 100644 --- a/jx/battle/refresh2.php +++ b/jx/battle/refresh2.php @@ -255,6 +255,6 @@ if (isset($_POST['atack'], $_POST['block']) || (isset($_POST['id']) && $_POST['i unset($atk1); } - echo ''; + echo ''; } } diff --git a/jx/battle/refresh_bot.php b/jx/battle/refresh_bot.php index 319541e3..8c957368 100644 --- a/jx/battle/refresh_bot.php +++ b/jx/battle/refresh_bot.php @@ -62,7 +62,7 @@ if (isset($CRON_CORE) && (isset($_POST['atack'], $_POST['block']) || (isset($_PO if (!isset($CRON_CORE)) { require_once('../../_incl_data/__config.php'); if ($_SESSION['tbr'] > $tm) { - die(''); + die(''); } else { $_SESSION['tbr'] = $tm + 0.350; } diff --git a/modules_data/btl_.php b/modules_data/btl_.php index 975e8cec..b29bc3e9 100644 --- a/modules_data/btl_.php +++ b/modules_data/btl_.php @@ -119,22 +119,22 @@ $allprice = Battle::getType($allprice, $thisBattle['smert'] == 1); } if (event.keyCode == 49) { - change_radioKeys(1, false); + change_radioKeys(1); } if (event.keyCode == 50) { - change_radioKeys(2, false); + change_radioKeys(2); } if (event.keyCode == 51) { - change_radioKeys(3, false); + change_radioKeys(3); } if (event.keyCode == 52) { - change_radioKeys(4, false); + change_radioKeys(4); } if (event.keyCode == 53) { - change_radioKeys(5, false); + change_radioKeys(5); } if (event.keyCode == 48) { - change_radioKeys(0, false); + change_radioKeys(); } @@ -207,9 +207,7 @@ $allprice = Battle::getType($allprice, $thisBattle['smert'] == 1); return null; } - if (delimiter == '' - || delimiter == false - || delimiter == null) { + if (!delimiter) { return false; } @@ -220,7 +218,7 @@ $allprice = Battle::getType($allprice, $thisBattle['smert'] == 1); return emptyArray; } - if (delimiter == true) { + if (delimiter) { delimiter = '1'; } @@ -1085,7 +1083,7 @@ $allprice = Battle::getType($allprice, $thisBattle['smert'] == 1); document.getElementById('reflesh_btn').setAttribute("disabled", "disabled"); document.getElementById('btn_down_img1').setAttribute("onclick", ""); document.getElementById('btn_down_img1').setAttribute("disabled", "disabled"); - reflesh(true); + reflesh(); timedCount(); }