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
_incl_data/class
modules_data/location

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

File diff suppressed because it is too large Load Diff

@ -3,8 +3,9 @@
use Core\Config; use Core\Config;
use Core\Db; 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')) { if (!defined('GAME')) {
die(); die();
} }
@ -147,10 +148,10 @@ if ($d->point['fileadd'] == 0 && $d->point['file'] != '0' && $d->point['file'] !
} }
} else { } else {
?> ?>
<script type="text/javascript" src="js/jquery.js"></script> <script src="/js/jquery.js"></script>
<script> <script>
let stor, bott, itemtake;
<?php if(!isset($_GET['ajax'])) { ?> //ТУТ передвижение <?php if(!isset($_GET['ajax'])) { ?> //ТУТ передвижение
// тут проверить // тут проверить
setInterval('top.c.noEr = 0;', 1000); 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); clearTimeout(top.c.noErTmr);
top.c.noErTmr = setTimeout('top.c.noEr = 0;', 1000); top.c.noErTmr = setTimeout('top.c.noEr = 0;', 1000);
} else if (event.which == 70 || event.which == 13) { } else if (event.which == 70 || event.which == 13) {
/* //ТУТ $u->info['x'] $u->info['y'] $u->info['dnow'] //ТУТ $u->info['x'] $u->info['y'] $u->info['dnow']
$u->info['s'] = 1(вперед) //$u->info['s'] = 1(вперед)
$u->info['s'] = 2(влево) //$u->info['s'] = 2(влево)
$u->info['s'] = 3(назад) //$u->info['s'] = 3(назад)
$u->info['s'] = 4(право) //$u->info['s'] = 4(право)
*/
stor = <?= $u->info['s'];?>; stor = <?= $u->info['s'];?>;
bott = 0;
if (stor == 1) { if (stor == 1) {
<?php <?php
$bottem = mysql_fetch_assoc( $args = [$u->info['dnow'], $u->info['x'], $u->info['y'] + 1];
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
}
?> ?>
} else if (stor == 2) { } else if (stor == 2) {
<?php <?php
$bottem = mysql_fetch_assoc( $args = [$u->info['dnow'], $u->info['x'] - 1, $u->info['y']];
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
}
?> ?>
} else if (stor == 3) { } else if (stor == 3) {
<?php <?php
$bottem = mysql_fetch_assoc( $args = [$u->info['dnow'], $u->info['x'], $u->info['y'] - 1];
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
}
?> ?>
} else if (stor == 4) { } else if (stor == 4) {
<?php <?php
$bottem = mysql_fetch_assoc( $args = [$u->info['dnow'], $u->info['x'] + 1, $u->info['y']];
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
}
?> ?>
} }
<?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) { if (bott != 0) {
window.location.href = "/main.php?atack=" + bott + "&rnd=<?= $code; ?>"; window.location.href = "/main.php?atack=" + bott + "&rnd=<?= $code; ?>";
} }
@ -764,9 +741,9 @@ if ($d->point['fileadd'] == 0 && $d->point['file'] != '0' && $d->point['file'] !
} }
$r = '<table style="display:inline-block;" border="0" cellspacing="0" cellpadding="0" height="10"><tr><td valign="middle" width="120" style="padding-top:12px"> $r = '<table style="display:inline-block;" border="0" cellspacing="0" cellpadding="0" height="10"><tr><td valign="middle" width="120" style="padding-top:12px">
<div style="position:relative;"><div id="vhp-1234600000' . $pl['id'] . '" title="Выполнение задания" align="left" class="seehp" style="position:absolute; top:-10px; width:120px; height:10px; z-index:12;"> ' . $xrz . '/' . $r . '</div> <div style="position:relative;"><div id="vhp-1234600000' . $pl['id'] . '" title="Выполнение задания" align="left" class="seehp" style="position:absolute; top:-10px; width:120px; height:10px; z-index:12;"> ' . $xrz . '/' . $r . '</div>
<div title="Выполнение задания" class="hpborder" style="position:absolute; top:-10px; width:120px; height:9px; z-index:13;"><img src="'. Config::img() .'/1x1.gif" height="9" width="1"></div> <div title="Выполнение задания" class="hpborder" style="position:absolute; top:-10px; width:120px; height:9px; z-index:13;"><img src="' . Config::img() . '/1x1.gif" height="9" width="1"></div>
<div class="hp_3 senohp" style="height:9px; width:120px; position:absolute; top:-10px; z-index:11;" id="lhp-1234600000' . $pl['id'] . '"><img src="'. Config::img() .'/1x1.gif" height="9" width="1"></div> <div class="hp_3 senohp" style="height:9px; width:120px; position:absolute; top:-10px; z-index:11;" id="lhp-1234600000' . $pl['id'] . '"><img src="' . Config::img() . '/1x1.gif" height="9" width="1"></div>
<div title="Выполнение задания" class="hp_none" style="position:absolute; top:-10px; width:120px; height:10px; z-index:10;"><img src="'. Config::img() .'/1x1.gif" height="10"></div> <div title="Выполнение задания" class="hp_none" style="position:absolute; top:-10px; width:120px; height:10px; z-index:10;"><img src="' . Config::img() . '/1x1.gif" height="10"></div>
</div></td></tr></table><br><script>top.startHpRegen("main",-1234600000' . $pl['id'] . ',' . $xrz . ',' . $r . ',0,0,0,0,0,0,1)</script>'; </div></td></tr></table><br><script>top.startHpRegen("main",-1234600000' . $pl['id'] . ',' . $xrz . ',' . $r . ',0,0,0,0,0,0,1)</script>';
$qsee .= '<small>Задание: &nbsp; ' . $pl['info'] . ' ' . $r . '</small><br>'; $qsee .= '<small>Задание: &nbsp; ' . $pl['info'] . ' ' . $r . '</small><br>';
@ -846,7 +823,7 @@ if ($d->point['fileadd'] == 0 && $d->point['file'] != '0' && $d->point['file'] !
position: absolute; position: absolute;
top: -8px; top: -8px;
left: -6px; left: -6px;
/ / background-image: url("<?= Config::img() ?>/drgn/bg/r.gif"); / / background-image: url("<?= Config::img() ?> /drgn/bg/r.gif");
} }
</style> </style>
</table> </table>
@ -889,7 +866,7 @@ if ($d->point['fileadd'] == 0 && $d->point['file'] != '0' && $d->point['file'] !
$sb1 = Db::getRow('select x, y from dungeon_obj where name like ? and dn = ? limit 1', ['%Шайба%', $d->info['id']]); $sb1 = Db::getRow('select x, y from dungeon_obj where name like ? and dn = ? limit 1', ['%Шайба%', $d->info['id']]);
while($pl = mysql_fetch_array($sp)) { while($pl = mysql_fetch_array($sp)) {
$css = '"background-image":"url('. Config::img() .'/fon555.png)",'; $css = '"background-image":"url(' . Config::img() . '/fon555.png)",';
$j = 0; $j = 0;
while ($j < 4) { while ($j < 4) {
@ -902,7 +879,7 @@ if ($d->point['fileadd'] == 0 && $d->point['file'] != '0' && $d->point['file'] !
} }
if(!empty($sb1) && $sb1['x'] == $pl['x'] && $sb1['y'] == $pl['y'] ) { if(!empty($sb1) && $sb1['x'] == $pl['x'] && $sb1['y'] == $pl['y'] ) {
echo '$("#min_' . $pl['x'] . '_' . $pl['y'] . '").html("<img class=\"u_rot' . $u->info['s'] . '\" title=\"Шайба!\" style=\"margin:2px 3px 3px 2px;background-image:url('. Config::img() .'/i/move/shb.gif)\" src=\"'. Config::img() .'/1x1.gif\" width=\"7\" height=\"7\">");'; echo '$("#min_' . $pl['x'] . '_' . $pl['y'] . '").html("<img class=\"u_rot' . $u->info['s'] . '\" title=\"Шайба!\" style=\"margin:2px 3px 3px 2px;background-image:url(' . Config::img() . '/i/move/shb.gif)\" src=\"' . Config::img() . '/1x1.gif\" width=\"7\" height=\"7\">");';
}elseif ($u->info['x'] == $pl['x'] && $u->info['y'] == $pl['y']) { }elseif ($u->info['x'] == $pl['x'] && $u->info['y'] == $pl['y']) {
if ($d->info['id2'] == 15) { if ($d->info['id2'] == 15) {
$tmbth = 4; $tmbth = 4;
@ -912,9 +889,9 @@ if ($d->point['fileadd'] == 0 && $d->point['file'] != '0' && $d->point['file'] !
} elseif ($tm['team'] == 2) { } elseif ($tm['team'] == 2) {
$tmbth = 2; $tmbth = 2;
} }
echo '$("#min_' . $pl['x'] . '_' . $pl['y'] . '").html("<img class=\"u_rot' . $u->info['s'] . '\" title=\"Это Вы\" style=\"margin:2px 3px 3px 2px;background-image:url('. Config::img() .'/i/move/p' . $tmbth . '/d0.gif)\" src=\"'. Config::img() .'/1x1.gif\" width=\"7\" height=\"7\">");'; echo '$("#min_' . $pl['x'] . '_' . $pl['y'] . '").html("<img class=\"u_rot' . $u->info['s'] . '\" title=\"Это Вы\" style=\"margin:2px 3px 3px 2px;background-image:url(' . Config::img() . '/i/move/p' . $tmbth . '/d0.gif)\" src=\"' . Config::img() . '/1x1.gif\" width=\"7\" height=\"7\">");';
} else { } else {
echo '$("#min_' . $pl['x'] . '_' . $pl['y'] . '").html("<img class=\"u_rot' . $u->info['s'] . '\" title=\"Это Вы\" style=\"margin:2px 3px 3px 2px;background-image:url('. Config::img() .'/i/move/p1/d0.gif)\" src=\"'. Config::img() .'/1x1.gif\" width=\"7\" height=\"7\">");'; echo '$("#min_' . $pl['x'] . '_' . $pl['y'] . '").html("<img class=\"u_rot' . $u->info['s'] . '\" title=\"Это Вы\" style=\"margin:2px 3px 3px 2px;background-image:url(' . Config::img() . '/i/move/p1/d0.gif)\" src=\"' . Config::img() . '/1x1.gif\" width=\"7\" height=\"7\">");';
} }
} elseif ($d->info['id2'] == 15) { } elseif ($d->info['id2'] == 15) {
$tmbth = 4; $tmbth = 4;
@ -930,12 +907,12 @@ if ($d->point['fileadd'] == 0 && $d->point['file'] != '0' && $d->point['file'] !
) )
); );
if (isset($tbshin['id'])) { if (isset($tbshin['id'])) {
echo '$("#min_' . $pl['x'] . '_' . $pl['y'] . '").html("<img class=\"u_rot' . $u->info['s'] . '\" title=\"Шайба!\" style=\"margin:2px 3px 3px 2px;background-image:url('. Config::img() .'/i/move/shb.gif)\" src=\"'. Config::img() .'/1x1.gif\" width=\"7\" height=\"7\">");'; echo '$("#min_' . $pl['x'] . '_' . $pl['y'] . '").html("<img class=\"u_rot' . $u->info['s'] . '\" title=\"Шайба!\" style=\"margin:2px 3px 3px 2px;background-image:url(' . Config::img() . '/i/move/shb.gif)\" src=\"' . Config::img() . '/1x1.gif\" width=\"7\" height=\"7\">");';
} else { } else {
echo '$("#min_' . $uxy[$pl['x'] . '_' . $pl['y']]['x'] . '_' . $uxy[$pl['x'] . '_' . $pl['y']]['y'] . '").html("<img class=\"u_rot' . $uxy[$pl['x'] . '_' . $pl['y']]['s'] . '\" title=\"' . $uxy[$pl['x'] . '_' . $pl['y']]['login'] . '\" style=\"margin:2px 3px 3px 2px;background-image:url('. Config::img() .'/i/move/p' . $tmbth . '/d0.gif)\" src=\"'. Config::img() .'/1x1.gif\" width=\"7\" height=\"7\">");'; echo '$("#min_' . $uxy[$pl['x'] . '_' . $pl['y']]['x'] . '_' . $uxy[$pl['x'] . '_' . $pl['y']]['y'] . '").html("<img class=\"u_rot' . $uxy[$pl['x'] . '_' . $pl['y']]['s'] . '\" title=\"' . $uxy[$pl['x'] . '_' . $pl['y']]['login'] . '\" style=\"margin:2px 3px 3px 2px;background-image:url(' . Config::img() . '/i/move/p' . $tmbth . '/d0.gif)\" src=\"' . Config::img() . '/1x1.gif\" width=\"7\" height=\"7\">");';
} }
}elseif (isset($uxy[$pl['x'] . '_' . $pl['y']])) { }elseif (isset($uxy[$pl['x'] . '_' . $pl['y']])) {
echo '$("#min_' . $uxy[$pl['x'] . '_' . $pl['y']]['x'] . '_' . $uxy[$pl['x'] . '_' . $pl['y']]['y'] . '").html("<img class=\"u_rot' . $uxy[$pl['x'] . '_' . $pl['y']]['s'] . '\" title=\"' . $uxy[$pl['x'] . '_' . $pl['y']]['login'] . '\" style=\"margin:2px 3px 3px 2px;background-image:url('. Config::img() .'/i/move/p4/d0.gif)\" src=\"'. Config::img() .'/1x1.gif\" width=\"7\" height=\"7\">");'; echo '$("#min_' . $uxy[$pl['x'] . '_' . $pl['y']]['x'] . '_' . $uxy[$pl['x'] . '_' . $pl['y']]['y'] . '").html("<img class=\"u_rot' . $uxy[$pl['x'] . '_' . $pl['y']]['s'] . '\" title=\"' . $uxy[$pl['x'] . '_' . $pl['y']]['login'] . '\" style=\"margin:2px 3px 3px 2px;background-image:url(' . Config::img() . '/i/move/p4/d0.gif)\" src=\"' . Config::img() . '/1x1.gif\" width=\"7\" height=\"7\">");';
} elseif( isset($bxy[$pl['x'] . '_' . $pl['y']]) ) { } elseif( isset($bxy[$pl['x'] . '_' . $pl['y']]) ) {
$bobrz = $bxy[$pl['x'] . '_' . $pl['y']]['obraz']; $bobrz = $bxy[$pl['x'] . '_' . $pl['y']]['obraz'];
@ -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;"> <div style="position:absolute; z-index:50; left: 374px; top: 110px;">
<img src="<?= Config::img() ?>/podzem-map2.png" alt=""/> <img src="<?= Config::img() ?>/podzem-map2.png" alt=""/>
</div> </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) { ?> <?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 } <?php }
if ($d->testGone(4) > 0) { ?> 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 } <?php }
if ($d->testGone(2) > 0) { ?> 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 } <?php }
if ($d->testGone(1) > 0) { ?> 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 } ?> <?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() ?>/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=""/> <img src="<?= Config::img() ?>/g7.jpg" width="24" height="19" id="g7" style="position:absolute;cursor:pointer; left: 476px; top: 28px;" alt=""/>