game/modules_data/location/a_fontan.php
2022-06-07 00:30:34 +03:00

190 lines
7.6 KiB
PHP

<?
if(!defined('GAME'))
{
die();
}
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 = 'Óðîâåíü ìàëîâàò ;)';
}
}
?>
<style>
body
{
background-color:#E2E2E2;
background-image: url(https://img.new-combats.com/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><? echo $u->room['name']; ?></h3>
</div>
<?
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><!-- -->
<? echo $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="https://img.new-combats.com/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=<? echo $code; ?>';" title="<? 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 />
<?
$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 />
<?
$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->microLogin($pl['uid'],1).' - '.$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;">
<?
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,'cp1251')).'")');
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->microLogin($pl['uid'],1)?>:<?
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>
<?
}
?>
</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>
<p>
<? } ?>
</p>