Файл: play_gamescool/fish/play.php
Строк: 67
<?php
include_once '../../connect.php';
$title = $title.' :: Онлайн рыбалка :: Ловим рыбку';
include_once '../../head.php';
if(!isset($u)){
header("Location:/index.php");
exit;
}
include_once 'inc/start.php';
$posts=array();
@$y=mysql_result(mysql_query("SELECT `id` FROM `fish_i` WHERE `id_u`='".$user_id."' AND `act`='1' AND `type`='y'"),0);
@$l=mysql_result(mysql_query("SELECT `id` FROM `fish_i` WHERE `id_u`='".$user_id."' AND `act`='1' AND `type`='l'"),0);
@$k=mysql_result(mysql_query("SELECT `id` FROM `fish_i` WHERE `id_u`='".$user_id."' AND `act`='1' AND `type`='k'"),0);
@$n=mysql_result(mysql_query("SELECT `id` FROM `fish_i` WHERE `id_u`='".$user_id."' AND `act`='1' AND `type`='n'"),0);
@$p=mysql_result(mysql_query("SELECT `id` FROM `fish_i` WHERE `id_u`='".$user_id."' AND `act`='1' AND `type`='p'"),0);
@$nap=mysql_result(mysql_query("SELECT `id` FROM `fish_i` WHERE `id_u`='".$user_id."' AND `act`='1' AND `type`='nap'"),0);
@$t=mysql_result(mysql_query("SELECT `id` FROM `fish_i` WHERE `id_u`='".$user_id."' AND `act`='1' AND `type`='nap'"),0);
if($t!=0){
@$y_l=mysql_result(mysql_query("SELECT `id_i` FROM `fish_i` WHERE `id_u`='".$user_id."' AND `act`='1' AND `type`='t'"),0);
@$t_ves=mysql_result(mysql_query("SELECT `yd` FROM `fish_pod` WHERE `id`='".$y_l."'"),0);
}
else
$t_ves=0;
if($nap!=0){
@$y_l=mysql_result(mysql_query("SELECT `id_i` FROM `fish_i` WHERE `id_u`='".$user_id."' AND `act`='1' AND `type`='nap'"),0);
@$nap_ves=mysql_result(mysql_query("SELECT `yd` FROM `fish_pod` WHERE `id`='".$y_l."'"),0);
}
else
$nap_ves=0;
if($p!=0){
@$y_l=mysql_result(mysql_query("SELECT `id_i` FROM `fish_i` WHERE `id_u`='".$user_id."' AND `act`='1' AND `type`='p'"),0);
@$p_ves=mysql_result(mysql_query("SELECT `yd` FROM `fish_pod` WHERE `id`='".$y_l."'"),0);
}
else
$p_ves=0;
@$y_l=mysql_result(mysql_query("SELECT `id_i` FROM `fish_i` WHERE `id_u`='".$user_id."' AND `act`='1' AND `type`='y'"),0);
@$y_ves=mysql_result(mysql_query("SELECT `ves` FROM `fish_pod` WHERE `id`='".$y_l."'"),0);
@$y_l=mysql_result(mysql_query("SELECT `id_i` FROM `fish_i` WHERE `id_u`='".$user_id."' AND `act`='1' AND `type`='l'"),0);
@$l_ves=mysql_result(mysql_query("SELECT `ves` FROM `fish_pod` WHERE `id`='".$y_l."'"),0);
@$y_l=mysql_result(mysql_query("SELECT `id_i` FROM `fish_i` WHERE `id_u`='".$user_id."' AND `act`='1' AND `type`='k'"),0);
@$k_ves=mysql_result(mysql_query("SELECT `ves` FROM `fish_pod` WHERE `id`='".$y_l."'"),0);
@$y_l=mysql_result(mysql_query("SELECT `id_i` FROM `fish_i` WHERE `id_u`='".$user_id."' AND `act`='1' AND `type`='n'"),0);
@$n_ves=mysql_result(mysql_query("SELECT `ves` FROM `fish_pod` WHERE `id`='".$y_l."'"),0);
if($y==0 || $l==0 || $k==0 || $n==0 || $fish['energy']<=0){
$posts[]=array('title'=>'Ошибкa!');
if($y==0)
$posts[]=array('title'=>'У вас нет удочки!');
if($l==0)
$posts[]=array('title'=>'У вас нет лески!');
if($k==0)
$posts[]=array('title'=>'У вас нет крючка!');
if($fish['energy']<=0)
$posts[]=array('title'=>'У вас нехватает энергии! Съеште что-нибудь, или подождите '.TimeSpent($fish["last_update"]-(time()-60*10)).'!');
if($n==0)
$posts[]=array('title'=>'У вас нет наживки!');
}
else
{
$posts[]=array('title'=>'~~<a href="play.php?refresh">Закинуть удочку</a>~~');
if(isset($_GET['refresh'])){
$rand=rand($fish['y'],100);
if($rand<93){
$quite=mysql_fetch_array(mysql_query("SELECT * FROM `fish` WHERE `level`<='".$fish['level']."' AND `m_id`='".$fish['loc']."' ORDER BY RAND() DESC LIMIT 1"));
$mas=rand(1,10);
if($rand<5)
$mas1=$quite['min_ves'];
else
$mas1=$quite['min_ves']+(($quite['min_ves']/100)*($mas*10));
if(is_double($mas1)){
$rand=rand(1,9);
$mas1=$mas1.$rand;
}
$rand=rand(1,3);
$sr=($y_ves+$l_ves+$n_ves+$k_ves)/4;
if($mas1>$sr && $rand==2 && $quite['level']!=40)
{
$posts[]=array('title'=>'Вы упустили рыбу<br/>','post'=>'Вы получаете + 1 опыта');
mysql_query("UPDATE `fish_u` SET `last_update`='".time()."', `energy`=`energy`-1,`exp`=`exp`+1 WHERE `id_u`='".$user_id."'");
mysql_query("UPDATE `fish_i` SET `kolvo`=`kolvo`-1 WHERE `id`='".$l."'");
mysql_query("UPDATE `fish_i` SET `kolvo`=`kolvo`-1 WHERE `id`='".$n."'");
}else{
if($p_ves!=0){
$mas1=$mas1+(($mas1/100)*$p_ves);
mysql_query("UPDATE `fish_i` SET `kolvo`=`kolvo`-1 WHERE `id`='".$p."'");
}
if($nap_ves!=0){
$mas1=$mas1+(($mas1/100)*$nap_ves);
mysql_query("UPDATE `fish_i` SET `kolvo`=`kolvo`-1 WHERE `id`='".$nap."'");
}
if($t_ves!=0){
$mas1=$mas1+(($mas1/100)*$t_ves);
mysql_query("UPDATE `fish_i` SET `kolvo`=`kolvo`-1 WHERE `id`='".$t."'");
}
$posts[]=array('icon'=>'<img src="f/'.$quite["id"].'.png"/>','title'=>'</br>Вы поймали рыбу '.$quite["name"].'<br/>','post'=>'Ёе вес составил '.$mas1.' кг . Вы получаете + '.$quite['cost'].' денег и+ '.$quite['exp'].' опыта');
if($mas1>$fish['max_ves'])
mysql_query("UPDATE `fish_u` SET `max_ves`='".$mas1."',`max_kogo`='".$quite['name']."' WHERE `id_u`='".$user_id."'");
mysql_query("UPDATE `fish_u` SET `last_update`='".time()."', `energy`=`energy`-1,`exp`=`exp`+$quite[exp], `balls`=`balls`+$quite[cost] WHERE `id_u`='".$user_id."'");
mysql_query("UPDATE `fish_i` SET `kolvo`=`kolvo`-1 WHERE `id`='".$l."'");
mysql_query("UPDATE `fish_i` SET `kolvo`=`kolvo`-1 WHERE `id`='".$n."'");
if(mysql_result(mysql_query("SELECT COUNT(*) FROM `fish_ulow` WHERE `id_u`='".$user_id."' AND `id_r`='".$quite['id']."'"),0)==0)
mysql_query("INSERT INTO `fish_ulow`(`id_u`,`id_r`,`ves`,`kolvo`) VALUES('".$user_id."','".$quite['id']."','".$mas1."','1')");
else
mysql_query("UPDATE `fish_ulow` SET `ves`=`ves`+$mas1,`kolvo`=`kolvo`+1 WHERE `id_u`='".$user_id."' AND `id_r`='".$quite['id']."'");
}
}
else
{
$posts[]=array('icon'=>'<img src="f/z.png"/>','title'=>'</br>Вы поймали золотую рыбку<br/>','post'=>'Вы получаете + 300 денег и 10 рубинов');
mysql_query("UPDATE `fish_u` SET `last_update`='".time()."', `energy`=`energy`-1,`rub`=`rub`+10, `balls`=`balls`+300 WHERE `id_u`='".$user_id."'");
mysql_query("UPDATE `fish_i` SET `kolvo`=`kolvo`-1 WHERE `id`='".$l."'");
mysql_query("UPDATE `fish_i` SET `kolvo`=`kolvo`-1 WHERE `id`='".$n."'");
}
}
}
$count=count($posts);
for($i=0;$i<$count;$i++){
if($i%2)
echo "<div class='div'>".implode($posts[$i])."</div>";
else
echo "<div class='div'>".implode($posts[$i])."</div>";
}
ret('В игру','index.php');
include_once '../../foot.php';
?>