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

231 lines
9.0 KiB
PHP

<?php
if(!defined('GAME'))
{
die();
}
if($u->room['file']=='ab/kareta')
{
$cs = ''; $sos = '';
$car = mysql_fetch_array(mysql_query('SELECT * FROM `vokzal` WHERE `name` = "'.$u->room['name'].'" LIMIT 1'));
if(isset($car['id']))
{
$sp = mysql_query('SELECT * FROM `vokzal` WHERE `city` = "'.$c['thiscity'].'" OR `tocity` = "'.$c['thiscity'].'"');
while($pl = mysql_fetch_array($sp))
{
$vz1 = mysql_fetch_array(mysql_query('SELECT * FROM `room` WHERE `name` = "Âîêçàë" AND `city` = "'.$pl['city'].'" LIMIT 1'));
$vz2 = mysql_fetch_array(mysql_query('SELECT * FROM `room` WHERE `name` = "Âîêçàë" AND `city` = "'.$pl['tocity'].'" LIMIT 1'));
$crm = mysql_fetch_array(mysql_query('SELECT * FROM `room` WHERE `name` = "'.$pl['name'].'" LIMIT 1'));
//period 0 - ïðèáûòèå â ãîðîä (ñòîÿíêà), 1 - äâèæåíèå, 3 - ïðèáûòèå â äðóãîé ãîðîä (ñòîÿíêà), 4 - äâèæåíèå (èç tocity)
if($pl['time_start_go']==0)
{
//Ýòî íîâàÿ êàðåòà îáíîâëÿåì äàííûå
mysql_query('UPDATE `vokzal` SET `time_start_go` = "'.(time()+$pl['timeStop']*60).'",`time_finish_go` = "'.(time()+$pl['timeStop']*60+$pl['time_go']*60).'" WHERE `id` = "'.$pl['id'].'" LIMIT 1');
$pl['time_start_go'] = time()+$pl['timeStop']*60;
$pl['time_finish_go'] = $pl['time_start_go']+$pl['time_go']*60;
}
$see = 0;
if($u->info['admin']>0)
{
$see = 1;
}
$plc = $pl['tocity'];
if($pl['time_start_go']-600<time() && $pl['time_start_go']>time())
{
//ìîæíî çíàíèìàòü ìåñòà â êàðåòå
if(isset($crm['id']))
{
$sr = mysql_query('SELECT `uid`,`id` FROM `items_users` WHERE `secret_id` = "'.$pl['time_start_go'].'_b'.$pl['id'].'" AND `delete` = "0" LIMIT 100');
while($pr = mysql_fetch_array($sr))
{
$upd1 = mysql_query('UPDATE `items_users` SET `delete` = "'.time().'" WHERE `id` = "'.$pr['id'].'" LIMIT 1');
if($upd1)
{
mysql_query('UPDATE `users` SET `room` = "'.$crm['id'].'" WHERE `online` > '.(time()-120).' AND `id` = "'.$pr['uid'].'" LIMIT 1');
}
}
}
}
//îòïðàâëÿåì êàðåòó â äðóãîé ãîðîä
if($pl['time_finish_go']<time())
{
//ïðèáûëè
if($pl['period']==0)
{
//Ïðèáûëè â ãîðîä, âðåìÿ ñòîÿíêè çàêîí÷èëîñü, è ïîåõàëè
mysql_query('UPDATE `vokzal` SET `period` = "1",`citygo` = "'.$pl['tocity'].'" WHERE `id` = "'.$pl['id'].'" LIMIT 1');
$pl['period'] = 1;
}elseif($pl['period']==1)
{
//ïðèåõàëèñ â äðóãîé ãîðîä, äåëàåì òàì ñòîÿíêó âûêèäûâàåì ëþäåé
if(isset($crm['id']))
{
mysql_query('UPDATE `users` SET `city` = "'.$pl['tocity'].'",`room` = "'.$vz2['id'].'" WHERE `room` = "'.$crm['id'].'" LIMIT '.$pl['bilets_default'].'');
}
mysql_query('UPDATE `vokzal` SET `bilets` = "'.$pl['bilets_default'].'",`citygo`="'.$pl['city'].'",`time_finish_go` = "'.(time()+$pl['timeStop']*60+$pl['time_go']*60).'",`time_start_go` = "'.(time()+$pl['timeStop']*60).'",`period` = "3" WHERE `id` = "'.$pl['id'].'" LIMIT 1');
$pl['period'] = 3;
}elseif($pl['period']==3)
{
//Ïðèáûëè â ãîðîä, âðåìÿ ñòîÿíêè çàêîí÷èëîñü, è ïîåõàëè
mysql_query('UPDATE `vokzal` SET `period` = "4" WHERE `id` = "'.$pl['id'].'" LIMIT 1');
$pl['period'] = 4;
}elseif($pl['period']==4)
{
//ïðèåõàëèñ â äðóãîé ãîðîä, äåëàåì òàì ñòîÿíêó è âûêèäûâàåì ëþäåé
if(isset($crm['id']))
{
mysql_query('UPDATE `users` SET `city` = "'.$pl['city'].'",`room` = "'.$vz1['id'].'" WHERE `room` = "'.$crm['id'].'" LIMIT '.$pl['bilets_default'].'');
}
mysql_query('UPDATE `vokzal` SET `bilets` = "'.$pl['bilets_default'].'",`citygo`="'.$pl['tocity'].'",`time_finish_go` = "'.(time()+$pl['timeStop']*60+$pl['time_go']*60).'",`time_start_go` = "'.(time()+$pl['timeStop']*60).'",`period` = "0" WHERE `id` = "'.$pl['id'].'" LIMIT 1');
$pl['period'] = 0;
}else{
echo '[?]';
}
}
}
}
if($re!=''){ echo '<div align="right"><font color="red"><b>'.$re.'</b></font></div>'; } ?>
<style type="text/css">
.pH3 { COLOR: #8f0000; FONT-FAMILY: Arial; FONT-SIZE: 12pt; FONT-WEIGHT: bold; }
.class_ {
font-weight: bold;
color: #C5C5C5;
cursor:pointer;
}
.class_st {
font-weight: bold;
color: #659BA3;
cursor:pointer;
}
.class__ {
font-weight: bold;
color: #FFFFFF;
cursor:pointer;
background-color: #659BA3;
}
.class__st {
font-weight: bold;
color: #FFFFFF;
cursor:pointer;
background-color: #659BA3;
font-size: 10px;
}
.class_old {
font-weight: bold;
color: #919191;
cursor:pointer;
}
.class__old {
font-weight: bold;
color: #FFFFFF;
cursor:pointer;
background-color: #838383;
font-size: 10px;
}
</style>
<TABLE width="100%" cellspacing="0" cellpadding="0">
<tr><td valign="top"><div align="center" class="pH3"><? echo $u->room['name']; ?></div>
<?php
echo '<b style="color:red">'.$error.'</b>';
?>
<center>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="400" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="150"><div align="left"></div></td>
<td><div align="left"></div></td>
</tr>
<tr>
<td><div align="left">Ìåñòî îòáûòèÿ:</div></td>
<td><div align="left"><? echo $u->city_name[$c['thiscity']]; ?></div></td>
</tr>
<tr>
<td><div align="left">Ìåñòî ïðèáûòèÿ:</div></td>
<td><div align="left"><? echo $u->city_name[$car['citygo']]; ?></div></td>
</tr>
<tr>
<td><div align="left">Ïðèáûòèå:</div></td>
<td><div align="left"><? echo date('H:i',$car['time_start_go']+$car['time_go']*60); ?></div></td>
</tr>
<tr>
<td><div align="left"></div></td>
<td><div align="left"></div></td>
</tr>
<tr>
<td><div align="left"></div></td>
<td><div align="left"></div></td>
</tr>
<tr>
<td><div align="left"></div></td>
<td><div align="left"></div></td>
</tr>
<tr>
<td><div align="left"></div></td>
<td><div align="left"></div></td>
</tr>
</table>
<div align="left">
<?
/*
img.combats-world.com/i/kareta1.swf - âåñíà (íî÷ü) 1 ìàðò
img.combats-world.com/i/kareta2.swf - âåñíà (äåíü)
img.combats-world.com/i/kareta3.swf - çèìà (íî÷ü) 1 äåêàáðÿ
img.combats-world.com/i/kareta4.swf - çèìà (äåíü)
img.combats-world.com/i/kareta5.swf - ëåòî (íî÷ü) 1 èþíÿ
img.combats-world.com/i/kareta6.swf - ëåòî (äåíü)
img.combats-world.com/i/kareta7.swf - îñåíü (íî÷ü) 1 ñåíòÿáðÿ
img.combats-world.com/i/kareta8.swf - îñåíü (äåíü)
1 - âåñíà
2 - ëåòî
3 - îñåíü
4 - çèìà
*/
$outimg = array(1=>4,2=>4,3=>1,4=>1,5=>1,6=>2,7=>2,8=>2,9=>3,10=>3,11=>3,12=>4);
$imgo = array(1=>1,2=>5,3=>7,4=>3);
$outimg = $imgo[$outimg[round(date('m',time()))]];
if(date('H',time())<22 && date('H',time())>6)
{
$outimg++;
}
?>
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="https://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0" width="220" height="175">
<param name="movie" value="https://img.new-combats.com/i/kareta<? if($outimg==''){ $outimg = 1; } echo $outimg; ?>.swf" />
<param name="quality" value="high" />
<param name="SCALE" value="exactfit" />
<embed src="https://img.new-combats.com/i/kareta<? echo $outimg; ?>.swf" width="220" height="175" quality="high" pluginspage="https://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" scale="exactfit"></embed>
</object>
</div></td>
<td valign="middle"><p>&nbsp;</p>
<div align="center">
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="https://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0" width="670" height="428">
<param name="movie" value="https://img.new-combats.com/flash/puzzle<? echo rand(1,13); ?>.swf" />
<param name="quality" value="high" /><param name="SCALE" value="exactfit" />
<embed src="https://img.new-combats.com/flash/puzzle<? echo rand(1,13); ?>.swf" width="670" height="428" quality="high" pluginspage="https://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" scale="exactfit"></embed>
</object>
</div></td>
</tr>
</table>
<b><br />
</b><small style="color:#999999;"><br />
</small>
</center>
<td width="280" valign="top"><div>
<div align="right">
<input onclick="location='main.php?rnd=<? echo $code; ?>';" type="button" value="îáíîâèòü" />
<input type="button" value="âûéòè èç êàðåòû" />
<br />
</div>
<br />
<br />
</div></td>
</table>
<br>
<div id="textgo" style="visibility:hidden;"></div>
<?
}
?>