Файл: inc/petfarm/petfarm.php
Строк: 262
<?
$title='Загоны';
include_once '../system/config.php';
define("rub", 1);
include_once '../user/Chest.php';
if(isset($_SESSION['err']))
{
echo err_game("Не хватает овощей в кормушке");
unset($_SESSION['err']);
}
echo"<div class='rzd2'></div><div class='menuin2'>";
echo "<div class='title'>Загоны</h2></div>";
echo "<div class='content'>";
echo "<div class='div'>";
echo "<div><img src='/img/icons/refresh.png' alt='o'> <a href='/barnyard/'>Обновить</a></div>";
if($ku['str'] == 5) {
if($ku['scarecrow_time']>$time)echo "<a class='epic' href='?shop=scarecrow'><img src='/img/icons/scarecrow.png' alt='o'></a> "; }else{ if($ku['scarecrow_time']>$time)echo "<li><img src='/img/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['str'] == 5) {
if($ku['time_shmel']>$time)echo "<a class='epic' href='?shop=helicopter&1'><img alt='o' src='/img/icons/heli1n.png'></a> "; }else{ if($ku['time_shmel']>$time)echo "<li><img alt='o' src='/img/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['str'] == 5) {
if($ku['time_drakon']>$time)echo "<a class='epic' href='?shop=helicopter&3'><img alt='o' src='/img/icons/heli3n.png'></a> "; }else{ if($ku['time_drakon']>$time)echo "<li><img alt='o' src='/img/icons/heli3n.png'> <a class='epic' href='/shop/helicopter/3'>Дракон</a><span class='minor'> на <span>".time_left($ku['time_drakon']-$time)."</span></span></li>"; }
echo "<ul>";
echo "<li class='pt'>";
{
$k_post = mysql_result(mysql_query("SELECT COUNT(*) FROM `kolhoz_petground` WHERE `id_user` = '$ku[id]'"),0);
if ($k_post==0)
{
echo "Список пуст...";
}
$k_page=k_page($k_post,$ku['str']);
$page=page($k_page);
$start=$ku['str']*$page-$ku['str'];
$num=($page-1)*$ku['str'];
$q=mysql_query("SELECT * FROM `kolhoz_petground` WHERE `id_user` = '$ku[id]' ORDER BY `id` DESC LIMIT $start, $ku[str]");
while($post=mysql_fetch_array($q))
{
$count_gol=0;
$max_time=$time+$post['level']*(3600*4);
$mezh_time=$max_time-$post['time'];
if($mezh_time>=4*3600)$count_gol++;
}
if($count_gol!=0 && $ku['fooder']>0)echo "<div><img src='/img/icons/harv.png' alt='o'> <a href='/barnyard/FoodAll/'>Накормить всех</a></div>";
}
if($ku['conveyor']>0 && !isset($_GET['moderate']))
{
$q=mysql_query("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_query("SELECT * FROM `kolhoz_pet` WHERE `id` = '$post[id_pet]'"));
$d_money=floor($post['time_money2']/(4*3600));
if($d_money>0)
{
$nt=$post['time_money2']-($d_money*14400);
$count=1;
$count_conveyor_act=0;
$count_vet_act=0;
$mc_count=0;
if(isset($conveyor_act))$count_conveyor_act=($count/100)*$conveyor_act;
if(isset($vet_act))$count_vet_act=($count/100)*$vet_ps_m;
if(isset($mc))$mc_count=($count/100)*($mc['level']*10);
$count=$count_conveyor_act+$count_vet_act+$count+$mc_count;
$money=($count*$pet['money'])*$d_money;
$money2=$money2+$money;
}
}
if($money2>0)echo "<div><img src='/img/icons/money.png' alt='o'> <a href='/barnyard/MoneyAll'>Продать все</a> за <span><img src='/img/icons/money.png' alt='o'> <span
class='n'>$money2</span></span></div>";
}
echo "</li>";
echo "<div class='ptm'><ul>";
$k_post = mysql_result(mysql_query("SELECT COUNT(*) FROM `kolhoz_petground` WHERE `id_user` = '$ku[id]'"),0);
if ($k_post==0)
{
echo "Список пуст...";
}
$k_page=k_page($k_post,$ku['str']);
$page=page($k_page);
$start=$ku['str']*$page-$ku['str'];
$num=($page-1)*$ku['str'];
$q=mysql_query("SELECT * FROM `kolhoz_petground` WHERE `id_user` = '$ku[id]' ORDER BY `id` DESC LIMIT $start, $ku[str]");
while($post=mysql_fetch_array($q))
{
$pet=mysql_fetch_array(mysql_query("SELECT * FROM `kolhoz_pet` WHERE `id` = '$post[id_pet]'"));
echo "<li><img style='border-radius: 5px' width='55' height='61' src='/img/".($post['id_pet']==0?"dirt_new_Pet.png":"pets/$pet[img].png")."' alt='o' class='portrait'>";
echo "<div>";
if($post['id_pet']==0)
{
echo "<img alt='o' src='/img/icons/animal.png'> <a href='/barnyard/buy/$post[id]'>Купить животное</a>";
}
else
{
if(!isset($_GET['moderate']))
{
echo "<span class='n'>".hsc($pet['name'])."</span>";
if($post['time']>$time)echo "<span class='small minor'> (Сытость на ".time_left($post['time']-$time).")</span>";
}
if(isset($_GET['moderate']))
{
if($pet['rub']){$img="ruby";}else{$img="money";}
echo "<li><img alt='' src='/img/icons/money.png'> <a href='/barnyard/sell/$post[id]'>Продать животное</a> за <span><img src='/img/icons/$img.png' alt='o'> <span
class='n'>".($pet['cena']/2)."</span></span></li>";
if($post['level']<20)
{
$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='' src='/img/icons/up.png'> <a href='/barnyard/level/$post[id]'>Увеличить ёмкость</a> за <span><img
width='16' height='16' src='/img/icons/money.png' alt='o'> <span class='n'>$post[next_level] тыс.</span></span>
<span class='small minor'>(с $post[level] до $post[next_level])</span></li>
<li><img alt='' src='/img/icons/up.png'> <a href='/barnyard/LevelAll/$post[id]'>Увеличить ёмкость</a> за <span><img
width='16' height='16' src='/img/icons/money.png' alt='o'> <span class='n'>$money_all_levels тыс.</span></span>
<span class='small minor'>(с $post[level] до 20)</span></li>";
}
}
else
{
echo "</div><div>";
$d_money=floor($post['time_money2']/(4*3600));
if($d_money>0)
{
$nt=$post['time_money2']-($d_money*14400);
$count=1;
$count_conveyor_act=0;
$count_vet_act=0;
$mc_count=0;
if(isset($conveyor_act))$count_conveyor_act=($count/100)*$conveyor_act;
if(isset($vet_act))$count_vet_act=($count/100)*$vet_ps_m;
if(isset($mc))$mc_count=($count/100)*($mc['level']*10);
$count=$count_conveyor_act+$count_vet_act+$count+$mc_count;
$money=($count*$pet['money'])*$d_money;
$assignment=($pet['count']*$d_money);
{}{}
echo "<img src='/img/icons/money.png' alt='o'> <a class='' href='/barnyard/money/$post[id]'>Продать ".$pet['tovar'].""; if($assignment>0)echo" (".($assignment)." шт)</a>"; echo" за <span><img src='/img/icons/money.png' alt='o'> <span
class='n'>$money</span></span>";
}
else
{
$max_time=$time+$post['level']*(3600*4);
$mezh_time=$max_time-$post['time'];
if($mezh_time>=4*3600)echo "<img src='/img/icons/harv.png' alt='o'> <a class='' href='/barnyard/food/$post[id]'><span>Покормить</span></a>";
}
}
}
echo "<div style='clear:both'></div></li>";
}
if(mysql_result(mysql_query("SELECT COUNT(*) FROM `kolhoz_petground` WHERE `id_user` = '$ku[id]'"),0)<40)echo "<li><img style='border-radius: 5px' width='55' height='61' src='/img/dirt_new_Pet.png' alt='o' class='portrait'><div><span class='n'>Новый загон</span></div><div><img src='/img/icons/cart.png' alt='o'> <a href='/barnyard/NewFold'>Купить</a>
за <span class='n'><img src='/img/icons/ruby.png' alt='o'> <span>".cpg(mysql_result(mysql_query("SELECT COUNT(*) FROM `kolhoz_petground` WHERE `id_user` = '$ku[id]'"),0))."</span> рубинов</span></div><div style='clear:both'></div></li>";
echo "</ul></div>";
if ($k_page>1)str("/barnyard/",$k_page,$page); // Вывод страниц
echo "<div class='ptm'><img src='/img/icons/refresh.png' alt='o'> <a href='/barnyard/'>Обновить</a><img alt='o' src='/img/icons/moderate.png'> <a href='/barnyard/page/$page/moderate'>Управление</a></li>";
if($mc['id']>0){echo"<li class='pt'><img src='/img/icons/heli4n.png' alt='o'> <a href='/kolhoz/hangar/$mc[id]/'>Вызвать вертолет</a></li>";}
echo '</ul></div></div>';
echo"</div></div><div class='rzd2'></div>";
include_once '../system/foot.php';
?>