refactor #php8

This commit is contained in:
Ivor Barhansky 2023-10-13 18:02:45 +03:00
parent e0b08e0b1a
commit bdbb359e20
3 changed files with 456 additions and 597 deletions

View File

@ -983,7 +983,7 @@ class Dialog
if ($this->info['tr_dn'] != $d->info['id2']) {
$go = 0;
} elseif ($this->info['x'] != 0 || $this->info['y'] != 0) {
if ($d->testLike($u->info['x'], $u->info['y'], $this->info['x'], $this->info['y']) != 1) {
if (!$d->cellIsGoodforAction($u->info['x'], $u->info['y'], $this->info['x'], $this->info['y'])) {
$go = 0;
}
//если бот погиб

File diff suppressed because it is too large Load Diff

View File

@ -3,8 +3,9 @@
use Core\Config;
use Core\Db;
echo "<script>document.getElementById('se-pre-con').parentNode.removeChild(document.getElementById('se-pre-con'));</script>";
echo "<script>
document.getElementById('se-pre-con').parentNode.removeChild(document.getElementById('se-pre-con'));
</script>";
if (!defined('GAME')) {
die();
}
@ -147,10 +148,10 @@ if ($d->point['fileadd'] == 0 && $d->point['file'] != '0' && $d->point['file'] !
}
} else {
?>
<script type="text/javascript" src="js/jquery.js"></script>
<script src="/js/jquery.js"></script>
<script>
let stor, bott, itemtake;
<?php if(!isset($_GET['ajax'])) { ?> //ТУТ передвижение
// тут проверить
setInterval('top.c.noEr = 0;', 1000);
@ -177,64 +178,40 @@ if ($d->point['fileadd'] == 0 && $d->point['file'] != '0' && $d->point['file'] !
clearTimeout(top.c.noErTmr);
top.c.noErTmr = setTimeout('top.c.noEr = 0;', 1000);
} else if (event.which == 70 || event.which == 13) {
/* //ТУТ $u->info['x'] $u->info['y'] $u->info['dnow']
$u->info['s'] = 1(вперед)
$u->info['s'] = 2(влево)
$u->info['s'] = 3(назад)
$u->info['s'] = 4(право)
*/
//ТУТ $u->info['x'] $u->info['y'] $u->info['dnow']
//$u->info['s'] = 1(вперед)
//$u->info['s'] = 2(влево)
//$u->info['s'] = 3(назад)
//$u->info['s'] = 4(право)
stor = <?= $u->info['s'];?>;
bott = 0;
if (stor == 1) {
<?php
$bottem = mysql_fetch_assoc(
mysql_query(
'SELECT `id2` FROM `dungeon_bots` WHERE `dn` = "' . $u->info['dnow'] . '" AND `delete` = "0" AND `x` = "' . ($u->info['x']) . '" AND `y` = "' . ($u->info['y'] + 1) . '" LIMIT 1'
)
);
if (isset($bottem['id2']))
{
?> bott = <?= $bottem['id2'];?>;<?php
}
$args = [$u->info['dnow'], $u->info['x'], $u->info['y'] + 1];
?>
} else if (stor == 2) {
<?php
$bottem = mysql_fetch_assoc(
mysql_query(
'SELECT `id2` FROM `dungeon_bots` WHERE `dn` = "' . $u->info['dnow'] . '" AND `delete` = "0" AND `x` = "' . ($u->info['x'] - 1) . '" AND `y` = "' . ($u->info['y']) . '" LIMIT 1'
)
);
if (isset($bottem['id2']))
{
?> bott = <?= $bottem['id2'];?>;<?php
}
$args = [$u->info['dnow'], $u->info['x'] - 1, $u->info['y']];
?>
} else if (stor == 3) {
<?php
$bottem = mysql_fetch_assoc(
mysql_query(
'SELECT `id2` FROM `dungeon_bots` WHERE `dn` = "' . $u->info['dnow'] . '" AND `delete` = "0" AND `x` = "' . ($u->info['x']) . '" AND `y` = "' . ($u->info['y'] - 1) . '" LIMIT 1'
)
);
if (isset($bottem['id2']))
{
?> bott = <?= $bottem['id2'];?>;<?php
}
$args = [$u->info['dnow'], $u->info['x'], $u->info['y'] - 1];
?>
} else if (stor == 4) {
<?php
$bottem = mysql_fetch_assoc(
mysql_query(
'SELECT `id2` FROM `dungeon_bots` WHERE `dn` = "' . $u->info['dnow'] . '" AND `delete` = "0" AND `x` = "' . ($u->info['x'] + 1) . '" AND `y` = "' . ($u->info['y']) . '" LIMIT 1'
)
);
if (isset($bottem['id2']))
{
?> bott = <?= $bottem['id2'];?>;<?php
}
$args = [$u->info['dnow'], $u->info['x'] + 1, $u->info['y']];
?>
}
<?php
$bottem = Db::getValue('select id2 from dungeon_bots where dn = ? and x = ? and y = ?', $args);
unset($args);
if (empty($bottem)) {
$bottem = 0;
}
?>
bott = <?= $bottem ?>;
if (bott != 0) {
window.location.href = "/main.php?atack=" + bott + "&rnd=<?= $code; ?>";
}
@ -960,18 +937,23 @@ if ($d->point['fileadd'] == 0 && $d->point['file'] != '0' && $d->point['file'] !
<div style="position:absolute; z-index:50; left: 374px; top: 110px;">
<img src="<?= Config::img() ?>/podzem-map2.png" alt=""/>
</div>
<img src="<?= Config::img() ?>/g1.jpg" title="Обновить, X:<?= $u->info['x'] ?> ,Y:<?= $u->info['y'] ?>" width="31" height="18" id="g1" style="position: absolute; cursor:pointer; left: 435px; top: 53px;" alt=""/>
<img src="<?= Config::img() ?>/g1.jpg" title="Обновить, X:<?= $u->info['x'] ?> ,Y:<?= $u->info['y'] ?>" width="31" height="18" id="g1"
style="position: absolute; cursor:pointer; left: 435px; top: 53px;" alt=""/>
<?php if ($d->testGone(3) > 0) { ?>
<img src="<?= Config::img() ?>/g2.jpg" onclick="goToLoca(3,'направо');" width="27" height="48" id="g2" style="position:absolute;cursor:pointer; left: 492px; top: 40px;" alt=""/>
<img src="<?= Config::img() ?>/g2.jpg" onclick="goToLoca(3,'направо');" width="27" height="48" id="g2"
style="position:absolute;cursor:pointer; left: 492px; top: 40px;" alt=""/>
<?php }
if ($d->testGone(4) > 0) { ?>
<img src="<?= Config::img() ?>/g3.jpg" onclick="goToLoca(4,'налево');" width="28" height="46" id="g3" style="position:absolute;cursor:pointer; left: 382px; top: 40px;" alt=""/>
<img src="<?= Config::img() ?>/g3.jpg" onclick="goToLoca(4,'налево');" width="28" height="46" id="g3"
style="position:absolute;cursor:pointer; left: 382px; top: 40px;" alt=""/>
<?php }
if ($d->testGone(2) > 0) { ?>
<img src="<?= Config::img() ?>/g4.jpg" onclick="goToLoca(2,'назад');" width="45" height="25" id="g4" style="position:absolute;cursor:pointer; left: 428px; top: 72px;" alt=""/>
<img src="<?= Config::img() ?>/g4.jpg" onclick="goToLoca(2,'назад');" width="45" height="25" id="g4"
style="position:absolute;cursor:pointer; left: 428px; top: 72px;" alt=""/>
<?php }
if ($d->testGone(1) > 0) { ?>
<img src="<?= Config::img() ?>/g5.jpg" onclick="goToLoca(1,'вперед');" width="46" height="26" id="g5" style="position:absolute;cursor:pointer; left: 428px; top: 26px;" alt=""/>
<img src="<?= Config::img() ?>/g5.jpg" onclick="goToLoca(1,'вперед');" width="46" height="26" id="g5"
style="position:absolute;cursor:pointer; left: 428px; top: 26px;" alt=""/>
<?php } ?>
<img src="<?= Config::img() ?>/g6.jpg" width="30" height="19" id="g6" style="position:absolute;cursor:pointer; left: 399px; top: 28px;" alt=""/>
<img src="<?= Config::img() ?>/g7.jpg" width="24" height="19" id="g7" style="position:absolute;cursor:pointer; left: 476px; top: 28px;" alt=""/>