Рефакторинг

This commit is contained in:
Ivor Barhansky 2023-06-11 14:51:42 +03:00
parent 2440ad3cc1
commit 0668d3de5f
2 changed files with 40 additions and 33 deletions

View File

@ -46,6 +46,7 @@ if (!defined('GAME_VERSION')) {
use Core\{Config, Database, Db};
use DarksLight2\Training\TrainingManager;
use User\ItemsModel;
use User\UserIp;
function var_info($vars, $d = false)
@ -70,9 +71,8 @@ $code = PassGen::intCode(); //для ссылок вида ?rnd=XXXXXX, врод
//$training_manager = TrainingManager::getInstance($u->info['id']);
/** Восстанавливаем всем ботам, которые не в бою здоровье до максимума. */
Db::exec(
'update stats set hpNow = hpAll, mpNow = mpAll
where id in (select id from users where bot = 2 and battle = 0)'
Db::sql(
'update stats set hpNow = hpAll, mpNow = mpAll where id in (select id from users where bot = 2 and battle = 0)'
);
if ($u->info['banned'] > 0) {
@ -138,7 +138,7 @@ if (!isset($_GET['mAjax']) && !isset($_GET['ajaxHostel'])) {
$act = -2;
$act2 = 0;
$u->stats = $u->getStats($u->info['id'], 0);
$u->aves = \User\ItemsModel::inventoryWeightAndItemQuantity();
$u->aves = ItemsModel::inventoryWeightAndItemQuantity();
if (!isset($u->stats['act'])) {
$u->stats['act'] = 0;
}
@ -365,7 +365,7 @@ if ($magic->youuse > 0) {
//Получение статов
if ($act != -2) {
$u->stats = $u->getStats($u->info['id'], 0, 1);
$u->aves = \User\ItemsModel::inventoryWeightAndItemQuantity();
$u->aves = ItemsModel::inventoryWeightAndItemQuantity();
if (!isset($sleep['id'])) {
$act2 = $u->testItems($u->info['id'], $u->stats, 0);
}
@ -433,12 +433,10 @@ if (isset($_GET['security']) && !isset($u->tfer['id']) && $trololo == 1) {
} else {
if (isset($_GET['talk']) && !isset($u->tfer['id'])) {
echo "
<script>
let elem = document.getElementById('se-pre-con');
elem.parentNode.removeChild(elem);
</script>
";
echo "<script>
let elem = document.getElementById('se-pre-con');
elem.parentNode.removeChild(elem);
</script>";
if ($u->info['dnow'] > 0) {
$d = new Dungeon;
$d->start();
@ -532,11 +530,11 @@ foreach ($sp as $pl) {
//выдаем предмет
$glid = 1;
if ($pl['data'] == '0') {
\User\ItemsModel::addItem(
ItemsModel::addItem(
$pl['item_id'], $u->info['id'], '|from_loc_id=' . $pl['id'] . '|from_loc=' . $u->info['room']
);
} else {
\User\ItemsModel::addItem(
ItemsModel::addItem(
$pl['item_id'], $u->info['id'],
'|from_loc_id=' . $pl['id'] . '|from_loc=' . $u->info['room'] . '|' . $pl['data']
);
@ -594,3 +592,10 @@ echo '<script>top.myexpLineTop27(' . $u->info['exp'] . ',' . $spl . ');' . $tjs
$(".se-pre-con").fadeOut(100);
});
</script>
<!--<script src="//ajax.googleapis.com/ajax/libs/jquery/3.7.0/jquery.min.js"></script>-->
<!--<script>-->
<!-- $(window).load(function() {-->
<!-- $(".se-pre-con").fadeOut("slow");-->
<!-- })-->
<!--</script>-->

View File

@ -12,21 +12,23 @@ if (!defined('GAME')) {
elem.parentNode.removeChild(elem);
function openMod(title, dat) {
var d = document.getElementById('useMagic');
if (d != undefined) {
document.getElementById('modtitle').innerHTML = '<table width="100%" border="0" cellspacing="0" cellpadding="0"><tr><td valign="top">' + title + '</td><td width="30" valign="top"><div align="right"><a title="Закрыть окно" onClick="closeMod(); return false;" href="#">x</a></div></td></tr></table>';
document.getElementById('moddata').innerHTML = dat;
d.style.display = '';
const d = document.getElementById('useMagic');
if (!d) {
return;
}
document.getElementById('modtitle').innerHTML = '<table width="100%" border="0" cellspacing="0" cellpadding="0"><tr><td valign="top">' + title + '</td><td width="30" valign="top"><div align="right"><a title="Закрыть окно" onClick="closeMod(); return false;" href="#">x</a></div></td></tr></table>';
document.getElementById('moddata').innerHTML = dat;
d.style.display = '';
}
function closeMod() {
var d = document.getElementById('useMagic');
if (d != undefined) {
document.getElementById('modtitle').innerHTML = '';
document.getElementById('moddata').innerHTML = '';
d.style.display = 'none';
const d = document.getElementById('useMagic');
if (!d) {
return;
}
document.getElementById('modtitle').innerHTML = '';
document.getElementById('moddata').innerHTML = '';
d.style.display = 'none';
}
</script>
<script src='<?= Config::img() ?>/js/commoninf.js'></script>
@ -152,7 +154,6 @@ if (isset($ba['id'])) {
$i++;
}
//if( isset($backdoor) ) {
$i = 0;
while ($i < count($bns2)) {
if (isset($bns2[$i][0]) && $_POST['buy4ekr'] >= $bns2[$i][0]) {
@ -160,7 +161,6 @@ if (isset($ba['id'])) {
}
$i++;
}
//}
//Бонус опытовый, первичный и накопительный
$out_ekr = $_POST['buy4ekr'];
@ -338,17 +338,17 @@ echo "<br><h4><div align=left>Необходимые средства в раб
$p['m1'] = 1;
$srok = [15 => '15 минут', 30 => '30 минут', 60 => 'один час', 180 => 'три часа', 360 => 'шесть часов', 720 => 'двенадцать часов', 1440 => 'одни сутки', 4320 => 'трое суток'];
if (isset($_GET['usemod'])) {
if (isset($_POST['usem1'])) {
require_once('moder/usem1.php');
}
if (isset($_GET['usemod']) && isset($_POST['usem1'])) {
require_once('moder/usem1.php');
}
if (isset($_POST['tologin'], $_POST['message'])) {
$cmsg = new ChatMessage();
$cmsg->setRoom(1);
$cmsg->setCity($infcity);
$cmsg->setTo($_POST['tologin']);
$cmsg->setText('<span style="color: darkblue; ">Сообщение телеграфом от </span> <b>' . $u->info['login'] . '</b>: ' . $_POST['message']);
$cmsg->setText(
'<span style="color: darkblue; ">Сообщение телеграфом от </span> <b>' . $u->info['login'] . '</b>: ' . $_POST['message']
);
$cmsg->setType(6);
(new Chat())->sendMsg($cmsg);
}
@ -359,9 +359,11 @@ if (isset($_POST['tologin'], $_POST['message'])) {
src="<?= Config::img() ?>/i/items/sleep.gif" title="Заклятие молчания"/></a>
&nbsp;
<br><h4>Телеграф</h4>
<form method=post style="margin:5px;">Логин персонажа <input type=text size=20 name="tologin"> сообщение <input
type=text size=80 name="message"> &nbsp; <input type=submit class="btn btn-success"
value="отправить"></form>
<form method=post style="margin:5px;">
Логин персонажа <input type=text size=20 name="tologin">
сообщение <input type=text size=80 name="message">
&nbsp; <input type=submit class="btn btn-success" value="отправить">
</form>
<?php
echo '<br><h2>Список реальщиков:</h2><br>';
$sp = mysql_query('SELECT * FROM `pay_operation` WHERE `good` > 0 GROUP BY `uid`');