<?
if(isset($_GET['ozero']) && isset($_GET['soil_all']) && mysql_result(mysql_query("SELECT COUNT(*) FROM `kolhoz_pond` WHERE `id_user` = '$ku[id]' AND `soil` = '0' AND (`time_soil` = '$time' OR `time_soil` < '$time') AND `id_plant` != '0' AND `time` > '$time'"),0)!=0 && $ku['catchfish']>0)
{
echo '<div class="event"><h1>Рыбная лавка</h1></div>';
echo "<div class='content'>";
echo "<div class='block'>";
if($ku['last_korm']!=0)
{
$soil=mysql_fetch_array(mysql_query("SELECT * FROM `kolhoz_korm` WHERE `id` = '$ku[last_korm]'"));
$cg=mysql_result(mysql_query("SELECT COUNT(*) FROM `kolhoz_pond` WHERE `id_user` = '$ku[id]' AND `soil` = '0' AND (`time_soil` = '$time' OR `time_soil` < '$time') AND `id_plant` != '0' AND `time` > '$time'"),0);
$sc=$cg*$soil['cena'];
if($ku['money']>=$sc)
{
$rat=$soil['rating'];
$rat_catchfisher_act=0;

if(isset($catchfish_act))$rat_catchfisher_act=(($rat/100)*$catchfish_act);
$rat=double_exp(base_exp($rat)+$rat_catchfisher_act);

$q=mysql_query("SELECT * FROM `kolhoz_pond` WHERE `id_user` = '$ku[id]' AND `soil` = '0' AND (`time_soil` = '$time' OR `time_soil` < '$time') AND `id_plant` != '0' AND `time` > '$time'");
$orat=0;
$vc=0;
while($post=mysql_fetch_array($q))
{
$plant=mysql_fetch_array(mysql_query("SELECT time FROM `kolhoz_fish` WHERE `id` = '$post[id_plant]'"));
$orat=$orat+$rat;
$st=$soil['time'];
$st_hp_act=0;
$st_mc_hp_act=0;
$st_soiler_act=0;
if(isset($catckorm_act))$st_catckorm_act=($plant['time']/100)*$catckorm_act;

$st=$st+$st_catckorm_act;
mysql_query("UPDATE `kolhoz_pond` SET `time` = '".($post['time']-$st)."', `soil` = '1' WHERE `id` = '$post[id]' LIMIT 1");
$vc=$vc+1;
}
mysql_query("UPDATE `kolhoz_user` SET `agronom` = '".($ku['agronom']+$vc)."',`money` = '".($ku['money']-$sc)."',`rating` = '".($ku['rating']+$orat)."' WHERE `id` = '$ku[id]'");
$_SESSION['rating']=$orat;
update_mc($orat);
}
else $_SESSION['no_money']=$sc-$ku['money'];
header("Location:/ozero/".passgen());
exit;
}
if(isset($_GET['select']) && intval($_GET['select'])!=NULL && mysql_result(mysql_query("SELECT COUNT(*) FROM `kolhoz_korm` WHERE `id` = '".intval($_GET['select'])."' AND (`level` = '$ku[level]' OR `level` < '$ku[level]')"),0)!=0)
{
mysql_query("UPDATE `kolhoz_user` SET `last_korm` = '".intval($_GET['select'])."' WHERE `id` = '$ku[id]'");
header("Location:/ozero/soil_all");
exit;
}
echo "<h3>Выбери Корм</h3>";
$q=mysql_query("SELECT * FROM `kolhoz_korm`");
echo "<ul>";
while($post=mysql_fetch_array($q))
{
echo "<li style='padding-bottom:8px'>";
echo "<img width='48' height='48' src='images/soils/korm$post[id].png' alt='o' class='portrait'><div>".($ku['level']>=$post['level']?"<a href='?ozero&soil_all&select=$post[id]'>":null)."<span>".hsc($post['name'])."</span>".($ku['level']>=$post['level']?"</a>":null)."<span class='minor'>, ".($ku['level']>=$post['level']?"цена: </span><span><img width='16' height='16' src='images/icons/money.png' alt='o'><span class='title'>$post[cena]</span></span>":"доступно с $post[level] уровня</span>")."</div><div class='minor small'>Ускоряет рост на <span class='title'>".time_left($post['time'])."</span>,опыт: <img width='16' height='16' src='images/icons/experience.png' alt='o'> <span class='title'>$post[rating]</span></div><div style='clear:both'></div></li>";
}
echo "</ul></div>";
include_once 'inc/foot.php';
}
?>