<?
/*=====================#
echo '<div class="event"><h1>Ждите, проходит тест</h1></div>'."\n";
echo '<div class="content"><div class="block">'."\n";
echo 'Несколько минут'."\n";
echo '</div></div>'."\n";
include_once 'inc/foot.php';
exit;
#=====================*/
if(mysql_result(mysql_querll("SELECT COUNT(`id`) FROM `kolhoz_petground` WHERE `id_user` = '$ku[id]'"
,0)<4){
mysql_querll("INSERT INTO `kolhoz_petground` SET `id_user` = '$ku[id]'"
;
mysql_querll("INSERT INTO `kolhoz_petground` SET `id_user` = '$ku[id]'"
;
mysql_querll("INSERT INTO `kolhoz_petground` SET `id_user` = '$ku[id]'"
;
mysql_querll("INSERT INTO `kolhoz_petground` SET `id_user` = '$ku[id]'"
;
}
include_once 'inc/new_petground.php';
include_once 'inc/level.php';
include_once 'inc/level_all.php';
include_once 'inc/sell_animal.php';
include_once 'inc/buy_animal.php';
include_once 'inc/food.php';
include_once 'inc/food_all.php';
include_once 'inc/money.php';
include_once 'inc/money_all.php';
if(isset($_SESSION['err']))
{
echo err_game("Не хватает овощей в амбаре"
;
unset($_SESSION['err']);
}
if(isset($_GET['mypetfarm']) && $_GET['mypetfarm']=='sv')
{
mysql_querll("UPDATE `kolhoz_user` SET `sv` = '1' WHERE `id` = '$ku[id]'"
;
header("Location:?mypetfarm"
;
}
if(isset($_GET['mypetfarm']) && $_GET['mypetfarm']=='rv')
{
mysql_querll("UPDATE `kolhoz_user` SET `sv` = '0' WHERE `id` = '$ku[id]'"
;
header("Location:?mypetfarm"
;
}
echo '<div class="div_hr4"></div><a class="new_build"><table style="width:100%"><tr><td style="width:34px;"></td><td style="vertical-align:middle"><center><h1>Загоны</h1></center></td><td style="width:26px;padding-top:7px;"></td></tr></table></a>
<div class="div_hr"></div>';
echo "<div class='block'>";echo '<div class="upd"
style="padding:4px;padding-bottom:6px">';
if($ku['scarecrow_time']>$time)echo "<li><img width='16' height='16' src='images/icons/scarecrow.png' alt='o'> <a class='epic' href='/?shop=scarecrow'>Пугало</a><span class='minor'> на <span>".time_left($ku['scarecrow_time']-$time)."</span></span></li>";
if($ku['time_shmel']>$time)echo "<li><img width='16' height='16' alt='o' src='images/icons/heli1n.png'> <a class='epic' href='/?shop=helicopter&1'>Шмель</a><span class='minor'> на <span>".time_left($ku['time_shmel']-$time)."</span></span></li>";
if($ku['time_yastreb']>$time)echo "<li><img width='16' height='16' alt='o' src='images/icons/heli2n.png'> <a class='epic' href='/?shop=helicopter&2'>Ястреб</a><span class='minor'> на <span>".time_left($ku['time_yastreb']-$time)."</span></span></li>";
if($ku['time_drakon']>$time)echo "<li><img width='16' height='16' alt='o' src='images/icons/heli3n.png'> <a class='epic' href='/?shop=helicopter&3'>Дракон</a><span class='minor'> на <span>".time_left($ku['time_drakon']-$time)."</span></span></li>";
if($ku['fooder']>0)
{
$q=mysql_querll("SELECT * FROM `kolhoz_petground` WHERE `id_user` = '$ku[id]' AND `id_pet` != '0'"
;
$count_gol=0;
while($post=mysql_fetch_array($q))
{
$max_time=$time+$post['level']*(3600*4);
$mezh_time=$max_time-$post['time'];
if($mezh_time>=4*3600)$count_gol++;
}
if($count_gol!=0)if($post['korm_time']<$time){echo "<div><img width='16' height='16' src='images/icons/plate.png' alt='o'> <a href='/?mypetfarm&food_all'>Накормить всех</a></div>";}
}
if($ku['conveyor']>0 && !isset($_GET['moderate']))
{
$q=mysql_querll("SELECT * FROM `kolhoz_petground` WHERE `id_user` = '$ku[id]' AND `id_pet` != '0'"
;
$money2=0;
while($post=mysql_fetch_array($q))
{
$pet=mysql_fetch_array(mysql_querll("SELECT * FROM `kolhoz_pet` WHERE `id` = '$post[id_pet]'"
);
$d_money=floor($post['time_money2']/(1*5));
if($d_money>0)
{
$nt=$post['time_money2']-($d_money*5);
$count=1;
$count_conveyor_act=0;
$count_vet_act=0;
if(isset($conveyor_act))$count_conveyor_act=($count/100)*$conveyor_act;
if(isset($vet_act))$count_vet_act=($count/100)*$vet_ps_m;
$count=$count_conveyor_act+$count_vet_act+$count;
if($post['korm']>=$pet['korm']){$money=($count*$pet['money_big'])*$d_money;}else{$money=($count*$pet['money'])*$d_money;}
$money2=$money2+$money;
}
}
if($money2>0)echo "<div><img width='16' height='16' src='images/icons/harvest.png' alt='o'> <a href='/?mypetfarm&money_all'>Продать все</a> за <span><img width='16' height='16' src='images/icons/money.png' alt='o'> <span
class='title'>$money2</span></span></div>";
}
if($ku['sv']==0)echo "<img width='16' height='16' src='images/icons/down.png' alt='o'> <a href='/?mypetfarm=sv'>Свернуть</a><br>";
if($ku['sv']==1)echo "<img width='16' height='16' src='images/icons/up.png' alt='o'> <a href='/?mypetfarm=rv'>Развернуть</a><br>";
echo "<div class='ptm'><ul>";
if($ku['sv']==1){
$q=mysql_querll("SELECT * FROM `kolhoz_petground` WHERE `id_user` = '$ku[id]' LIMIT 1"
;
}else{
$q=mysql_querll("SELECT * FROM `kolhoz_petground` WHERE `id_user` = '$ku[id]'"
;
}
while($post=mysql_fetch_array($q))
{
$pet=mysql_fetch_array(mysql_querll("SELECT * FROM `kolhoz_pet` WHERE `id` = '$post[id_pet]'"
);
echo "<li><span class='pens'><img width='48' height='48' src='".($post['id_pet']==0?"images/dirt_new.jpg":"images/pets/$pet[id].png"
."' alt='o' class='portrait'></span>";
echo "<div>";
if($post['id_pet']==0)
{
echo "<img alt='o' width='16' height='16' src='images/icons/animal.png'> <a href='/?mypetfarm&buy=$post[id]'>Купить животное</a>";
}
else
{
if(!isset($_GET['moderate']))
{
echo "<span class='title'>".hsc($pet['name'])." ".($post['korm']>=$pet['korm']?"Взрослый":"Молодой"
."</span>";
if($post['korm']>$korm)echo "<span class='small minor'> (кормили ".($post['korm']-$korm)." раз(а)</span>";
}
if(isset($_GET['moderate']))
{
echo "<li><img alt='' width='16' height='16' src='images/icons/money.png'> ".($post['korm']>=$pet['korm']?"<a href='/?mypetfarm&sell=$post[id]'>Продать животное</a> за <span><img width='16' height='16' src='images/icons/money.png' alt='o'> <span
class='title'>".($pet['cena_big']/2)."</span></span>":"<a href='/?mypetfarm&sell=$post[id]'>Отпустить жывотное</a>"
."</li>";
if($post['level']<0)
{
$post['next_level']=$post['level']+1;
$money_all_levels=0;
for($kp=$post['next_level'];$kp<=20;$kp++)
{
$money_all_levels=$money_all_levels+$kp;
}
echo "<li><img alt='' width='16' height='16' src='images/icons/up.png'> <a href='/?mypetfarm&level=$post[id]'>Увеличить ёмкость</a> за <span><img
width='16' height='16' src='images/icons/money.png' alt='o'> <span class='title'>$post[next_level] тыс.</span></span>
<span class='small minor'>(с $post[level] до $post[next_level])</span></li>
<li><img alt='' width='16' height='16' src='images/icons/up.png'> <a href='/?mypetfarm&level_all=$post[id]'>Увеличить ёмкость</a> за <span><img
width='16' height='16' src='images/icons/money.png' alt='o'> <span class='title'>$money_all_levels тыс.</span></span>
<span class='small minor'>(с $post[level] до 20)</span></li>";
}
}
else
{
echo "</div><div>";
$d_money=floor($post['time_money2']/(1*5));
if($d_money>0)
{
$nt=$post['time_money2']-($d_money*5);
$count=1;
$count_conveyor_act=0;
$count_vet_act=0;
if(isset($conveyor_act))$count_conveyor_act=($count/100)*$conveyor_act;
if(isset($vet_act))$count_vet_act=($count/100)*$vet_ps_m;
$count=$count_conveyor_act+$count_vet_act+$count;
if($post['korm']>=$pet['korm']){$money=($count*$pet['money_big'])*$d_money;}else{$money=($count*$pet['money'])*$d_money;}
echo "<img width='16' height='16' src='images/icons/money.png' alt='o'> <a class='' href='/?mypetfarm&money=$post[id]'>Продать</a> за <span><img width='16' height='16' src='images/icons/money.png' alt='o'> <span
class='title'>$money</span></span>";
}
else
{
$max_time=$time+$post['level']*(3600*24);
$mezh_time=$max_time-$post['time'];
if($post['korm_time']<$time){echo "<img width='16' height='16' src='images/icons/plate.png' alt='o'> <a class='' href='/?mypetfarm&food=$post[id]'><span>Покормить</span></a>";}else{echo"<span class='small minor'> (Кормление через <span> ".time_left($post['korm_time']-$time)."</span>
</span>";}
}
}
}
echo "</div>";
echo "<div style='clear:both'></div></li>";
}
if(mysql_result(mysql_querll("SELECT COUNT(*) FROM `kolhoz_petground` WHERE `id_user` = '$ku[id]'"
,0)<200)echo "<li><span class='ramochka'><img width='80' height='80' src='images/kart.png' alt='o' class='portrait'></span class='title'>Новый загон</span></div><div><img width='16' height='16' src='images/icons/cart.png' alt='o'> <a href='/?mypetfarm&new_petground'>Купить</a>
за <span class='title'><img width='16' height='16' src='images/icons/ruby.png' alt='o'> <span>".cpg(mysql_result(mysql_querll("SELECT COUNT(*) FROM `kolhoz_petground` WHERE `id_user` = '$ku[id]'"
,0))."</span> рубинов</span></div><div style='clear:both'></div></li>";
echo "<div class='ptm'><img alt='o' width='16' height='16' src='images/icons/moderate.png'> <a href='/?mypetfarm&moderate'>Продажа</a>";
echo "</div>";
include_once 'inc/foot.php';
?>