211 lines
7.9 KiB
PHP
211 lines
7.9 KiB
PHP
<?
|
|
if(!defined('GAME')) { die(); }
|
|
if($u->room['file']=='ruine_enter') {
|
|
|
|
$loc_c = array(
|
|
'users' => 2, // ñêîëüêî ÷åëîâåê íóæíî äëÿ ñòàðòà
|
|
'money' => '0.00', // ñêîëüêî êð. íóæíî äëÿ âõîäà
|
|
'free' => 125
|
|
);
|
|
|
|
if(isset($_GET['join'])) {
|
|
$rz = mysql_fetch_array(mysql_query('SELECT * FROM `ruine_zv` WHERE `uid` = "'.$u->info['id'].'" LIMIT 1'));
|
|
if(isset($rz['id'])) {
|
|
$u->error = 'Âû óæå ïðèíèìàåòå ó÷àñòèå â òóðíèðå';
|
|
}else{
|
|
$rc = mysql_fetch_array(mysql_query('SELECT COUNT(*) FROM `ruine_zv` LIMIT 1'));
|
|
if( $rc[0] >= $loc_c['users'] ) {
|
|
$u->error = 'Âû îïîçäàëè, ýòà ãðóïïà óæå íà÷àëà òóðíèð. Ïîïðîáóéòå åùå ðàç...';
|
|
}else{
|
|
if( $u->info['money'] < (int)$loc_c['money'] ) {
|
|
$u->error = 'Äëÿ ó÷àñòèÿ â òóðíèðå íåîáõîäèìî çàïëàòèòü '.$loc_c['money'].' êð.';
|
|
}else{
|
|
mysql_query('INSERT INTO `ruine_zv` (
|
|
`city`,`time`,`uid`,`money`
|
|
) VALUES (
|
|
"'.$u->info['city'].'","'.time().'","'.$u->info['id'].'","'.((int)$loc_c['money']).'"
|
|
)');
|
|
mysql_query('UPDATE `users` SET `money` = "'.($u->info['money'] - (int)$loc_c['money']).'" WHERE `id` = "'.$u->info['id'].'" LIMIT 1');
|
|
$u->error = 'Âû çàïëàòèëè '.$loc_c['money'].' êð. çà ó÷àñòèå â òóðíèðå.';
|
|
}
|
|
}
|
|
unset($rc);
|
|
}
|
|
}elseif(isset($_GET['cancel'])) {
|
|
$rz = mysql_fetch_array(mysql_query('SELECT * FROM `ruine_zv` WHERE `uid` = "'.$u->info['id'].'" LIMIT 1'));
|
|
if(!isset($rz['id'])) {
|
|
$u->error = 'Âû íå ó÷àñòâóåòå â òóðíèðå';
|
|
}else{
|
|
$rc = mysql_fetch_array(mysql_query('SELECT COUNT(*) FROM `ruine_zv` LIMIT 1'));
|
|
if( $rc[0] >= $loc_c['users'] ) {
|
|
$u->error = 'Òóðíèð óæå íà÷àëñÿ...';
|
|
}else{
|
|
mysql_query('DELETE FROM `ruine_zv` WHERE `id` = "'.$rz['id'].'" LIMIT 1');
|
|
mysql_query('UPDATE `users` SET `money` = "'.($u->info['money'] + $rz['money']).'" WHERE `id` = "'.$rz['uid'].'" LIMIT 1');
|
|
$u->error = 'Âû âåðíóëè '.$loc_c['money'].' êð. è ïîêèíóëè òóðíèðíóþ çàÿâêó.';
|
|
}
|
|
unset($rc);
|
|
}
|
|
}
|
|
|
|
?>
|
|
<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>
|
|
</td>
|
|
<td width="200" valign="top"><div align="right">
|
|
<table cellspacing="0" cellpadding="0">
|
|
<tr>
|
|
<td width="100%"> </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="#" id="greyText" class="menutop" onclick="location='main.php?loc=1.180.0.323&rnd=<? echo $code; ?>';">Áîëüøàÿ ïàðêîâàÿ óëèöà</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="0">
|
|
<tr>
|
|
<td align="left" valign="top">
|
|
<?
|
|
if($u->error != '') {
|
|
echo '<div><b><font color=red>'.$u->error.'</font></b></div><br>';
|
|
}
|
|
?>
|
|
Âñåãî îäåðæàíî ïîáåä â ðóèíàõ: 0<br><br>
|
|
<?
|
|
//
|
|
$i = 0;
|
|
$sp = mysql_query('SELECT * FROM `ruine_zv`');
|
|
while( $pl = mysql_fetch_array($sp) ) {
|
|
$usr = mysql_fetch_array(mysql_query('SELECT `online`,`money` FROM `users` WHERE `id` = "'.$pl['uid'].'" LIMIT 1'));
|
|
if( $usr['online'] < time()-600 ) {
|
|
mysql_query('UPDATE `users` SET `money` = "'.($usr['money'] + $pl['money']).'" WHERE `id` = "'.$pl['uid'].'" LIMIT 1');
|
|
mysql_query('DELETE FROM `ruine_zv` WHERE `id` = "'.$pl['id'].'" LIMIT 1');
|
|
}else{
|
|
$i++;
|
|
}
|
|
}
|
|
//
|
|
if( $i >= $loc_c['users'] ) {
|
|
//
|
|
mysql_query('INSERT INTO `ruine_now` (
|
|
`time_start`,`time_finish`,`t1w`,`t2w`,`tw`
|
|
) VALUES (
|
|
"'.time().'","0","0","0","0"
|
|
)');
|
|
$text_user = '';
|
|
$rid = mysql_insert_id();
|
|
//
|
|
$team = rand(1,2);
|
|
//
|
|
if( $rid > 0 ) {
|
|
//
|
|
$sp = mysql_query('SELECT * FROM `ruine_zv`');
|
|
while( $pl = mysql_fetch_array($sp) ) {
|
|
//
|
|
if( $team == 1 ) {
|
|
$team = 2;
|
|
}else{
|
|
$team = 1;
|
|
}
|
|
//
|
|
$bus = mysql_fetch_array(mysql_query('SELECT * FROM `users` WHERE `id` = "'.$pl['uid'].'" LIMIT 1'));
|
|
if(isset($bus['id'])) {
|
|
//Ñîçäàåì áîòà
|
|
$text_user[$team] .= $u->microLogin($bus['id'],1).', ';
|
|
//
|
|
mysql_query('INSERT INTO `users` (`obraz`,`chatColor`,`align`,`inTurnir`,`molch1`,`molch2`,`login`,`room`,`name`,`sex`,`level`,`bithday`) VALUES (
|
|
"'.$bus['obraz'].'","'.$bus['chatColor'].'","'.$bus['align'].'","'.$rid.'","'.$bus['molch1'].'","'.$bus['molch2'].'","'.$bus['login'].'","413","'.$bus['name'].'","'.$bus['sex'].'","10","'.date('d.m.Y').'")');
|
|
//
|
|
$inbot = mysql_insert_id(); //àéäè áîòà
|
|
if( $inbot > 0 ) {
|
|
//Ñîçäàåì äàííûå â ðóèíàõ
|
|
$rx = 0;
|
|
$ry = 0;
|
|
//
|
|
$botst = mysql_fetch_array(mysql_query('SELECT * FROM `ruine_sets` WHERE `uid` = "'.$bus['id'].'" AND `use` = 1 LIMIT 1'));
|
|
if(!isset($botst['id'])) {
|
|
$botst = array(
|
|
's1' => 0,'s2' => 0,'s3' => 0,'s4' => 0,'s5' => 0,'s6' => 0,
|
|
'free' => $loc_c['free']
|
|
);
|
|
}
|
|
//
|
|
mysql_query('INSERT INTO `stats` (`res_x`,`res_y`,`timeGo`,`timeGoL`,`upLevel`,`dnow`,`id`,`stats`,`exp`,`ability`,`skills`,`x`,`y`)
|
|
VALUES (
|
|
"'.$rx.'","'.$ry.'",
|
|
"'.(time()+180).'","'.(time()+180).'","81","0","'.$inbot.'",
|
|
"s1='.round($botst['s1']+3).'|s2='.round($botst['s2']+3).'|s3='.round($botst['s3']+3).'|s4='.round($botst['s4']+3).'|s5='.round($botst['s5']).'|s6='.round($botst['s6']).'|rinv=40|m9=5|m6=10","0",
|
|
"'.$botst['free'].'","11","'.$rx.'","'.$ry.'"
|
|
)');
|
|
//
|
|
mysql_query('UPDATE `users` SET `room` = "414", `inUser` = "'.$inbot.'" WHERE `id` = "'.$bus['id'].'" LIMIT 1');
|
|
//
|
|
mysql_query('INSERT INTO `ruine_users` (
|
|
`tid`,`team`,`uid`,`bot`,`die`,`last_die`,`money`
|
|
) VALUES (
|
|
"'.$rid.'","'.$team.'","'.$bus['id'].'","'.$inbot.'","0","0","'.$pl['money'].'"
|
|
)');
|
|
//
|
|
mysql_query('DELETE FROM `ruine_zv` WHERE `id` = "'.$pl['id'].'" LIMIT 1');
|
|
//
|
|
}
|
|
//
|
|
}
|
|
//
|
|
}
|
|
//
|
|
}
|
|
//
|
|
$text_user[1] = rtrim($text_user[1],', ');
|
|
$text_user[2] = rtrim($text_user[2],', ');
|
|
$text = 'Òóðíèð ìåæäó '.$text_user[1].' è '.$text_user[2].' íà÷àëñÿ.';
|
|
//
|
|
mysql_query('INSERT INTO `ruine_logs` (
|
|
`tid`,`time`,`text`
|
|
) VALUES (
|
|
"'.$rid.'","'.time().'","'.mysql_real_escape_string($text).'"
|
|
)');
|
|
//
|
|
}
|
|
//
|
|
$rz = mysql_fetch_array(mysql_query('SELECT * FROM `ruine_zv` WHERE `uid` = "'.$u->info['id'].'" LIMIT 1'));
|
|
echo 'Ãðóïïà ñ õàîòè÷íûì ðàñïðåäåëåíèåì. Íàáðàíî '.$i.'/'.$loc_c['users'].' ÷åë. ';
|
|
if( isset($rz['id']) ) {
|
|
echo '<input onClick="location.href=\'https://new-combats.com/main.php?cancel\';" type="button" value="Ïîêèíóòü ãðóïïó" class="btnnew">';
|
|
}else{
|
|
echo '<input onClick="location.href=\'https://new-combats.com/main.php?join\';" type="button" value="Ïðèñîåäèíèòüñÿ" class="btnnew">';
|
|
}
|
|
?>
|
|
</td>
|
|
<td align="right" valign="top">
|
|
<input type="button" value="Îáíîâèòü" class="btnnew" onclick="location.href='https://new-combats.com/main.php';">
|
|
<input type="button" value="Ïðîôèëè õàðàêòåðèñòèê" class="btnnew2" onclick="top.winframe('ruine_fm','Ïðîôèëè õàðàêòåðèñòèê',590,480,'https://new-combats.com/ruin_characteristics.php');">
|
|
<input type="button" value="Ëîãè òåêóùèõ òóðíèðà" class="btnnew">
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
<? } ?>
|