Перенос разрозненных файлов в фабрику. Утилизация неиспользуемых функций. #49

This commit is contained in:
2023-12-05 03:01:04 +02:00
committed by Ivor Barhansky
parent c51dbaeae3
commit 8be1c6cd7e
79 changed files with 12178 additions and 12956 deletions

View File

@@ -1,190 +1,204 @@
<?php
if(!defined('GAME'))
{
die();
if (!defined('GAME')) {
die();
}
if($u->room['file']=='a_fontan')
if ($u->room['file'] == 'a_fontan')
{
if(isset($_GET['useloc1'])) {
//Восстанавливаем НР и МР
$allmn = mysql_fetch_array(mysql_query('SELECT COUNT(`id`) FROM `fontan_hp` WHERE `date` = "'.date('dmY').'" AND `city` = "'.$u->info['city'].'" AND `uid` = "'.$u->info['id'].'" AND `delete` = "0" LIMIT 1'));
$allmn = $allmn[0];
if($allmn > 0) {
$re = 'Вы уже пили из фонтана сегодня...';
}else{
$re = 'Вы попили воды и почувствовали прилив энергии!';
$u->stats['hpNow'] = $u->stats['hpAll'];
$u->stats['mpNow'] = $u->stats['mpAll'];
mysql_query('UPDATE `stats` SET `hpNow` = "'.$u->stats['hpNow'].'",`mpNow` = "'.$u->stats['mpNow'].'" WHERE `id` = "'.$u->info['id'].'" LIMIT 1');
mysql_query('INSERT INTO `fontan_hp` (`uid`,`date`,`time`,`city`) VALUES ("'.$u->info['id'].'","'.date('dmY').'","'.time().'","'.$u->info['city'].'")');
}
}elseif(isset($_GET['luckloc1'])) {
//бросаем 1 кр.
if($u->info['level'] > 3) {
if($u->info['money'] < 1) {
$re = 'Требуется 1 кр.';
}else{
$allmn = mysql_fetch_array(mysql_query('SELECT COUNT(`id`) FROM `fontan` WHERE `date` = "'.date('dmY').'" AND `city` = "'.$u->info['city'].'" AND `uid` = "'.$u->info['id'].'" LIMIT 50'));
$allmn = $allmn[0];
if($allmn > 49) {
$re = 'В фонтан возможно кинуть не более 50 монеток в сутки';
}else{
$u->info['money'] -= 1;
$rmn = 0;
if(rand(0,100000) < 3890) {
$rmn = floor(rand(200,3978)/100);
$re = 'Фортуна на вашей стороне! Вы выиграли '.$rmn.'кр.';
$u->info['money'] += $rmn;
}else{
$re = 'Вы бросили монетку, но ничего не произошло :(';
}
mysql_query('INSERT INTO `fontan` (`uid`,`time`,`date`,`win`,`money`,`city`) VALUES ("'.$u->info['id'].'","'.time().'","'.date('dmY').'","'.$rmn.'","1","'.$u->info['city'].'")');
mysql_query('UPDATE `users` SET `money` = "'.$u->info['money'].'" WHERE `id` = "'.$u->info['id'].'" LIMIT 1');
}
}
}else{
$re = 'Уровень маловат ;)';
}
}
if (isset($_GET['useloc1'])) {
//Восстанавливаем НР и МР
$allmn = mysql_fetch_array(mysql_query('SELECT COUNT(`id`) FROM `fontan_hp` WHERE `date` = "' . date('dmY') . '" AND `city` = "' . $u->info['city'] . '" AND `uid` = "' . $u->info['id'] . '" AND `delete` = "0" LIMIT 1'));
$allmn = $allmn[0];
if ($allmn > 0) {
$re = 'Вы уже пили из фонтана сегодня...';
} else {
$re = 'Вы попили воды и почувствовали прилив энергии!';
$u->stats['hpNow'] = $u->stats['hpAll'];
$u->stats['mpNow'] = $u->stats['mpAll'];
mysql_query('UPDATE `stats` SET `hpNow` = "' . $u->stats['hpNow'] . '",`mpNow` = "' . $u->stats['mpNow'] . '" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1');
mysql_query('INSERT INTO `fontan_hp` (`uid`,`date`,`time`,`city`) VALUES ("' . $u->info['id'] . '","' . date('dmY') . '","' . time() . '","' . $u->info['city'] . '")');
}
} elseif (isset($_GET['luckloc1'])) {
//бросаем 1 кр.
if ($u->info['level'] > 3) {
if ($u->info['money'] < 1) {
$re = 'Требуется 1 кр.';
} else {
$allmn = mysql_fetch_array(mysql_query('SELECT COUNT(`id`) FROM `fontan` WHERE `date` = "' . date('dmY') . '" AND `city` = "' . $u->info['city'] . '" AND `uid` = "' . $u->info['id'] . '" LIMIT 50'));
$allmn = $allmn[0];
if ($allmn > 49) {
$re = 'В фонтан возможно кинуть не более 50 монеток в сутки';
} else {
$u->info['money'] -= 1;
$rmn = 0;
if (rand(0, 100000) < 3890) {
$rmn = floor(rand(200, 3978) / 100);
$re = 'Фортуна на вашей стороне! Вы выиграли ' . $rmn . 'кр.';
$u->info['money'] += $rmn;
} else {
$re = 'Вы бросили монетку, но ничего не произошло :(';
}
mysql_query('INSERT INTO `fontan` (`uid`,`time`,`date`,`win`,`money`,`city`) VALUES ("' . $u->info['id'] . '","' . time() . '","' . date('dmY') . '","' . $rmn . '","1","' . $u->info['city'] . '")');
mysql_query('UPDATE `users` SET `money` = "' . $u->info['money'] . '" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1');
}
}
} else {
$re = 'Уровень маловат ;)';
}
}
?>
<style>
body
{
background-color:#E2E2E2;
background-image: url(//img.new-combats.tech/i/misc/showitems/dungeon.jpg);
background-repeat:no-repeat;background-position:top right;
}
body {
background-color: #E2E2E2;
background-image: url(//img.new-combats.tech/i/misc/showitems/dungeon.jpg);
background-repeat: no-repeat;
background-position: top right;
}
</style>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><div style="padding-left:0px;" align="center">
<h3><?= $u->room['name']; ?></h3>
</div>
<?php
if($re != '') {
echo '<font style="float:left" color="red"><b>'.$re.'</b></font>';
}
?>
</td>
<td width="200"><div align="right">
<table cellspacing="0" cellpadding="0">
<tr>
<td width="100%">&nbsp;</td>
<td><table border="0" cellpadding="0" cellspacing="0">
<tr align="right" valign="top">
<td><!-- -->
<?= $goLis; ?>
<!-- -->
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td nowrap="nowrap"><table width="100%" border="0" cellpadding="0" cellspacing="1" bgcolor="#DEDEDE">
<tr>
<td bgcolor="#D3D3D3"><img src="//img.new-combats.tech/i/move/links.gif" width="9" height="7" /></td>
<td bgcolor="#D3D3D3" nowrap="nowrap"><a href="javascript:void(0)" id="greyText" class="menutop" onclick="location='main.php?loc=1.180.0.9&rnd=<?= $code; ?>';" title="<?php thisInfRm('1.180.0.9',1); ?>">Центральная площадь</a></td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
</table>
</div></td>
</tr>
<tr>
<td>
<div style="padding-left:0px;" align="center">
<h3><?= $u->room['name']; ?></h3>
</div>
<?php
if ($re != '') {
echo '<font style="float:left" color="red"><b>' . $re . '</b></font>';
}
?>
</td>
<td width="200">
<div align="right">
<table cellspacing="0" cellpadding="0">
<tr>
<td width="100%">&nbsp;</td>
<td>
<table border="0" cellpadding="0" cellspacing="0">
<tr align="right" valign="top">
<td><!-- -->
<?= $goLis; ?>
<!-- -->
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td nowrap="nowrap">
<table width="100%" border="0" cellpadding="0" cellspacing="1" bgcolor="#DEDEDE">
<tr>
<td bgcolor="#D3D3D3"><img src="//img.new-combats.tech/i/move/links.gif" width="9" height="7"/></td>
<td bgcolor="#D3D3D3" nowrap="nowrap"><a href="javascript:void(0)" id="greyText" class="menutop"
onclick="location='main.php?loc=1.180.0.9&rnd=<?= $code; ?>';"
title="<?php thisInfRm('1.180.0.9', 1); ?>">Центральная площадь</a></td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</div>
</td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="10">
<tr>
<td align="center">
<table border="0" width="900">
<tr>
<td height="100" colspan="5" align="center" valign="top">&nbsp;
<p><a href="?luckloc1=1">Бросить монетку</a> (<strong>1</strong>кр.) <span style="margin-left:400px;margin-right:20px;"><a href="?useloc1=1">Выпить воды</a></span></p><br /><br /></td>
</tr>
<tr>
<td width="80">&nbsp;</td>
<td width="310" align="left" valign="top"> В сутки можно бросить в фонтан не больше 50 монеток.<br />
<br />
<?php
$allmn = mysql_fetch_array(mysql_query('SELECT SUM(`win`) FROM `fontan` WHERE `delete` = "0"'));
$allmn = 0+$allmn[0];
?>
Всего выиграно: <b><?=$allmn?></b>кр.<br />
<br />
<b>20</b> последних выигрышей:<br />
<?php
$sp = mysql_query('SELECT * FROM `fontan` WHERE `delete` = "0" AND `win` > 0 ORDER BY `id` DESC LIMIT 20');
while($pl = mysql_fetch_array($sp)) {
echo $u->getLogin($pl['uid']).' - '.$pl['win'].'кр.<br>';
}
?>
<br /></td>
<td width="90">&nbsp;</td>
<td width="300" valign="top"><br />
<table style="
<tr>
<td align="center">
<table border="0" width="900">
<tr>
<td height="100" colspan="5" align="center" valign="top">&nbsp;
<p><a href="?luckloc1=1">Бросить монетку</a> (<strong>1</strong>кр.) <span style="margin-left:400px;margin-right:20px;"><a href="?useloc1=1">Выпить воды</a></span></p>
<br/><br/></td>
</tr>
<tr>
<td width="80">&nbsp;</td>
<td width="310" align="left" valign="top"> В сутки можно бросить в фонтан не больше 50 монеток.<br/>
<br/>
<?php
$allmn = mysql_fetch_array(mysql_query('SELECT SUM(`win`) FROM `fontan` WHERE `delete` = "0"'));
$allmn = 0 + $allmn[0];
?>
Всего выиграно: <b><?= $allmn ?></b>кр.<br/>
<br/>
<b>20</b> последних выигрышей:<br/>
<?php
$sp = mysql_query('SELECT * FROM `fontan` WHERE `delete` = "0" AND `win` > 0 ORDER BY `id` DESC LIMIT 20');
while ($pl = mysql_fetch_array($sp)) {
echo User::getLogin($pl['uid']) . ' - ' . $pl['win'] . 'кр.<br>';
}
?>
<br/></td>
<td width="90">&nbsp;</td>
<td width="300" valign="top"><br/>
<table style="
white-space: pre-wrap;
white-space: -moz-pre-wrap;
white-space: -pre-wrap;
white-space: -o-pre-wrap;
word-wrap: break-word;">
<?php
if(isset($_GET['delm'])) {
if($u->info['admin'] > 0 || ($u->info['align'] > 1 && $u->info['align'] < 2)) {
mysql_query('UPDATE `fontan_text` SET `delete` = "'.$u->info['id'].'" WHERE `id` = "'.mysql_real_escape_string($_GET['delm']).'" LIMIT 1');
echo '<font color=red><b>Сообщение стерто</b></font>';
}
}
if(isset($_POST['message'])) {
$tstm = mysql_fetch_array(mysql_query('SELECT COUNT(`id`) FROM `fontan_text` WHERE `uid` = "'.$u->info['id'].'" AND `time` > '.(time()-10).' LIMIT 1'));
if($u->info['molch1'] < time() && $u->info['level'] > 0 && $u->info['align'] != 2 && $tstm[0] < 1) {
if(str_replace(' ','',str_replace(' ','',$_POST['message']))) {
mysql_query('INSERT INTO `fontan_text` (`uid`,`time`,`text`) VALUES ("'.$u->info['id'].'","'.time().'","'.mysql_real_escape_string(htmlspecialchars($_POST['message'],NULL)).'")');
echo '<font color=red><b>Сообщение добавлено</b></font>';
}else{
echo '<font color=red><b>Пустое сообщение!</b></font>';
}
}else{
echo '<font color=red><b>Вам пока-что запрещено оставлять пожелания!</b></font>';
}
}
echo '<br>&nbsp; &nbsp; &nbsp; <b>Пожелания!</b><br><br>';
$sp = mysql_query('SELECT * FROM `fontan_text` WHERE `city` = "'.$u->info['city'].'" AND `delete` = "0" ORDER BY `id` DESC LIMIT 10');
while($pl = mysql_fetch_array($sp)){
?>
<tr>
<td align="left" valign="top" style="
<?php
if (isset($_GET['delm'])) {
if ($u->info['admin'] > 0 || ($u->info['align'] > 1 && $u->info['align'] < 2)) {
mysql_query('UPDATE `fontan_text` SET `delete` = "' . $u->info['id'] . '" WHERE `id` = "' . mysql_real_escape_string($_GET['delm']) . '" LIMIT 1');
echo '<font color=red><b>Сообщение стерто</b></font>';
}
}
if (isset($_POST['message'])) {
$tstm = mysql_fetch_array(mysql_query('SELECT COUNT(`id`) FROM `fontan_text` WHERE `uid` = "' . $u->info['id'] . '" AND `time` > ' . (time() - 10) . ' LIMIT 1'));
if ($u->info['molch1'] < time() && $u->info['level'] > 0 && $u->info['align'] != 2 && $tstm[0] < 1) {
if (str_replace(' ', '', str_replace(' ', '', $_POST['message']))) {
mysql_query('INSERT INTO `fontan_text` (`uid`,`time`,`text`) VALUES ("' . $u->info['id'] . '","' . time() . '","' . mysql_real_escape_string(htmlspecialchars($_POST['message'], null)) . '")');
echo '<font color=red><b>Сообщение добавлено</b></font>';
} else {
echo '<font color=red><b>Пустое сообщение!</b></font>';
}
} else {
echo '<font color=red><b>Вам пока-что запрещено оставлять пожелания!</b></font>';
}
}
echo '<br>&nbsp; &nbsp; &nbsp; <b>Пожелания!</b><br><br>';
$sp = mysql_query('SELECT * FROM `fontan_text` WHERE `city` = "' . $u->info['city'] . '" AND `delete` = "0" ORDER BY `id` DESC LIMIT 10');
while ($pl = mysql_fetch_array($sp)) {
?>
<tr>
<td align="left" valign="top" style="
white-space: pre-wrap;
white-space: -moz-pre-wrap;
white-space: -pre-wrap;
white-space: -o-pre-wrap;
word-wrap: break-word;"><div style="padding:0 10px 5px 10px; margin:5px; border-bottom:1px solid #cac9c7;"><?=$u->getLogin($pl['uid'])?>:<?php
if($u->info['admin'] > 0 || ($u->info['align'] > 1 && $u->info['align'] < 2)) {
echo ' <a href="?delm='.$pl['id'].'"><small>стереть</small></a>';
}
?><br /><?=$pl['text']?></div></td>
word-wrap: break-word;">
<div style="padding:0 10px 5px 10px; margin:5px; border-bottom:1px solid #cac9c7;"><?= User::getLogin($pl['uid']) ?>:<?php
if ($u->info['admin'] > 0 || ($u->info['align'] > 1 && $u->info['align'] < 2)) {
echo ' <a href="?delm=' . $pl['id'] . '"><small>стереть</small></a>';
}
?><br/><?= $pl['text'] ?></div>
</td>
</tr>
<?php
}
?>
</table>
<center>
<!-- pages -->
<!-- -->
</center>
<form action='main.php' method='post'>
Оставить сообщение:<br/>
<input type="text" name="message" size="35" value="" maxlength="150"/>
<br/>
<input type="submit" name="add" value="Добавить"/>
</form>
<div id="hint3" class="ahint"></div>
</td>
<td width="70">&nbsp;</td>
</tr>
<?php
}
?>
</table>
<center>
<!-- pages -->
<!-- -->
</center>
<form action='main.php' method='post'>
Оставить сообщение:<br />
<input type="text" name="message" size="35" value="" maxlength="150" />
<br />
<input type="submit" name="add" value="Добавить" />
</form>
<div id="hint3" class="ahint"></div></td>
<td width="70">&nbsp;</td>
</tr>
</table></td>
</tr>
</table>
</td>
</tr>
</table>
<p>
<?php } ?>
<?php } ?>
</p>

View File

@@ -276,7 +276,7 @@ if (!isset($_GET['r'])) {
</script>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="center" valign="top" bgcolor="#D6D6D6"><?= $u->getLogin() ?></td>
<td align="center" valign="top" bgcolor="#D6D6D6"><?= User::getLogin($u->info['id']) ?></td>
<td align="center" valign="top" bgcolor="#D6D6D6"><B>Подходящие предметы в инвентаре</B></td>
</tr>
<tr>
@@ -389,7 +389,7 @@ if (!isset($_GET['r'])) {
</script>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="center" valign="top" bgcolor="#D6D6D6"><?= $u->getLogin() ?></td>
<td align="center" valign="top" bgcolor="#D6D6D6"><?= User::getLogin($u->info['id']) ?></td>
<td align="center" valign="top" bgcolor="#D6D6D6"><b>Подходящие предметы в инвентаре</b></td>
</tr>
<tr>

View File

@@ -25,7 +25,7 @@ while ($pl = mysql_fetch_array($sp)) {
}
$i++;
$uidz[$pl['uid']] = $i;
$text .= $i . '. <span class="date">' . date('d.m.Y H:i', $pl['time']) . '</span>, Волна: <b>' . $pl['voln'] . '</b>, ' . $u->getLogin($pl['uid']) . '<br>';
$text .= $i . '. <span class="date">' . date('d.m.Y H:i', $pl['time']) . '</span>, Волна: <b>' . $pl['voln'] . '</b>, ' . User::getLogin($pl['uid']) . '<br>';
}
if (empty($text)) {
$text = 'История пуста, скорее всего не нашлось смельчаков...';

View File

@@ -775,8 +775,8 @@ if ($r == 1) {
//Подгонка под комплект
$see = $u->genInv(
64, '`iu`.`id` = "' . mysql_real_escape_string(
$_GET['upgradelvlcom']
) . '" AND `iu`.`uid`="' . $u->info['id'] . '" AND `iu`.`delete`="0" AND `iu`.`inOdet`="0" AND `iu`.`inShop`="0" AND (`iu`.`data` LIKE "%|art=1%" ' . $itmos . ')'
$_GET['upgradelvlcom']
) . '" AND `iu`.`uid`="' . $u->info['id'] . '" AND `iu`.`delete`="0" AND `iu`.`inOdet`="0" AND `iu`.`inShop`="0" AND (`iu`.`data` LIKE "%|art=1%" ' . $itmos . ')'
);
}
$see = $see[2];
@@ -893,7 +893,7 @@ if ($re != '') {
echo '<a href="?r=5&rnd=' . $code . '">Подгонка</a>';
} ?>&nbsp;&nbsp;
</td>
<td nowrap="nowrap" style="position: absolute; right: 290px;"><?= $u->getLogin() ?></td>
<td nowrap="nowrap" style="position: absolute; right: 290px;"><?= User::getLogin($u->info['id']) ?></td>
<td width="90%">&nbsp;</td>
</tr>
</table>

View File

@@ -827,7 +827,7 @@ if ($hostel['balance'] <= 0 && $u->room['id'] != 214 && $sleep['vars'] != 'sleep
<table bgcolor="#c8c8c8" width="100%" cellspacing="0" cellpadding="0" border="0">
<tr>
<td width="52%" style="border-left:1px solid #a5a5a5; border-bottom:1px solid #a5a5a5; padding:2px 0px 2px 5px;"
align='left'><?= $u->getLogin() ?></td>
align='left'><?= User::getLogin($u->info['id']) ?></td>
<td style="<?= ($result['additional'] == '' ? 'border-bottom:1px solid #a5a5a5;' : '') ?>"
align='center'><?= ($result['additional'] != '' ? $result['additional'] : '') ?></td>
<td style="border-right:1px solid #a5a5a5; border-bottom:1px solid #a5a5a5; padding: 2px 15px 2px 0px;" align='right'><h4