<?php
require_once 'core/system.php';
head('Тренировка Питомца');
reg();
$my_pets = $dbc->query("SELECT * FROM `user_pets` WHERE `id_user` = '".$user['id']."'")->fetch_assoc(); if($my_pets == false) { header('Location: spet.php');exit;}
if($my_pets['def'] < 2000){ $brony=$my_pets['def'] * 2 / 100;}elseif($my_pets['def'] >= 2000){ $brony = 20;}
$cena_sila = 10000*$my_pets['tren_sila']+10000;
$cena_crit = 100*$my_pets['tren_crit']+1000;
if($cena_sila>=200000){ $cena_sila = 200000;}
$cena_hp = 2000*$my_pets['tren_hp']+10000;
if($cena_hp>=200000){ $cena_hp = 200000;}
$cena_def = 10000*$my_pets['tren_def']+10000;
if($cena_def>=200000){ $cena_def = 200000;}
if(isset($_GET['up_sila'])){
if($my_pets['tren_sila']>=500){header('location:tren_pet.php');exit;}
if($user['serebro']<$cena_sila){ $_SESSION['message']='не достаточно средств'; header('location:tren_pet.php');exit;}
$dbc->query("UPDATE `user_pets` SET `str`=`str`+1,`tren_sila`=`tren_sila`+1 ,`tren`=`tren`+'".$cena_sila."' WHERE `id_user`='".$user['id']."' ");
$dbc->query("UPDATE `users` SET `serebro`=`serebro`-'".$cena_sila."' WHERE `id`='".$user['id']."' ");
$_SESSION['message']='Сила + 1';
header('location:tren_pet.php');exit;}
if(isset($_GET['up_crit'])){
if($my_pets['tren_crit']>=70){header('location:tren_pet.php');exit;}
if($user['rub']<$cena_crit){ $_SESSION['message']='не достаточно средств'; header('location:tren_pet.php');exit;}
$dbc->query("UPDATE `user_pets` SET `crit`=`crit`+1,`tren_crit`=`tren_crit`+1 ,`tren_gold`=`tren_gold`+'".$cena_crit."' WHERE `id_user`='".$user['id']."' ");
$dbc->query("UPDATE `users` SET `rub`=`rub`-'".$cena_crit."' WHERE `id`='".$user['id']."' ");
$_SESSION['message']='Крит + 1';
header('location:tren_pet.php');exit;}
if(isset($_GET['up_hp'])){
if($my_pets['tren_hp']>=3000){header('location:tren_pet.php');exit;}
if($user['serebro']<$cena_hp){ $_SESSION['message']='не достаточно средств'; header('location:tren_pet.php');exit;}
$dbc->query("UPDATE `user_pets` SET `vit`=`vit`+5,`tren_hp`=`tren_hp`+5 ,`tren`=`tren`+'".$cena_hp."' WHERE `id_user`='".$user['id']."' ");
$dbc->query("UPDATE `users` SET `serebro`=`serebro`-'".$cena_hp."' WHERE `id`='".$user['id']."' ");
$_SESSION['message']='Здоровье + 5';
header('location:tren_pet.php');exit;}
if(isset($_GET['up_def'])){
if($my_pets['tren_def']>=500){header('location:tren_pet.php');exit;}
if($user['serebro']<$cena_def){ $_SESSION['message']='не достаточно средств'; header('location:tren_pet.php');exit;}
$dbc->query("UPDATE `user_pets` SET `def`=`def`+1,`tren_def`=`tren_def`+1 ,`tren`=`tren`+'".$cena_def."' WHERE `id_user`='".$user['id']."' ");
$dbc->query("UPDATE `users` SET `serebro`=`serebro`-'".$cena_def."' WHERE `id`='".$user['id']."' ");
$_SESSION['message']='Защита + 1';
header('location:tren_pet.php');exit;}
?>
<div class="mt10"><div class="lblue-panel">
<div class="panel-inner">
<div>
<div>Параметры:</div>
<div><img src="img/stat/hp.png" width="12" height="12" alt="*" /> Здоровье: <?=$my_pets['vit']?></div>
<div><img src="img/stat/AKulak.png" width="12" height="12" alt="*" /> Сила: <?=$my_pets['str']?></div>
<div><img src="images/icons/armor.png" width="12" height="12" alt="*" /> Защита: <?=$my_pets['def']?><span class="info">(<?=$brony?>%)</span></div>
<div><img src="img/stat/mp.png" width="12" height="12" alt="*" /> Крит: <?=$my_pets['crit']?>%</div>
<div>
</div>
</div><?
?><center><span class="info">Тренировка</span></center><?
?><table>
<tr>
<td style="width: 45px;"><img src="img/icon/pet_sila.png" style="box-shadow: 0px 0px 20px green; margin: 10px;"></td>
<td>Острые Когти(<?=$my_pets['tren_sila']?>) </br><div class="font-small text-italic c-verygray"><font color=grey>Повышает Атаку питомца</font></br>
</div>
</td>
</tr>
</table> <?
?><center><a href="tren_pet.php?up_sila"><input class="btn big" type="submit" value="Тренировать За <?=$cena_sila?> серебра "></a></center><?
?><table>
<tr>
<td style="width: 45px;"><img src="img/icon/pet_hp.png" style="box-shadow: 0px 0px 20px green; margin: 10px;"></td>
<td>Живучесть(<?=$my_pets['tren_hp']?>) </br><div class="font-small text-italic c-verygray"><font color=grey>Повышает Здоровье питомца</font></br>
</div>
</td>
</tr>
</table> <?
?><center><a href="tren_pet.php?up_hp"><input class="btn big" type="submit" value="Тренировать За <?=$cena_hp?> серебра "></a></center><?
?><table>
<tr>
<td style="width: 45px;"><img src="img/icon/pet_def.png" style="box-shadow: 0px 0px 20px green; margin: 10px;"></td>
<td>Крепкая Броня(<?=$my_pets['tren_def']?>) </br><div class="font-small text-italic c-verygray"><font color=grey>Повышает Защиту питомца</font></br>
</div>
</td>
</tr>
</table> <?
?><center><a href="tren_pet.php?up_def"><input class="btn big" type="submit" value="Тренировать За <?=$cena_def?> серебра "></a></center><?
?><table>
<tr>
<td style="width: 45px;"><img src="img/icon/pet_crit.png" style="box-shadow: 0px 0px 20px green; margin: 10px;"></td>
<td>Ярость(<?=$my_pets['tren_crit']?>) </br><div class="font-small text-italic c-verygray"><font color=grey>Повышает шанс крит-удара питомца</font></br>
</div>
</td>
</tr>
</table> <?
?><center><a href="tren_pet.php?up_crit"><input class="btn big" type="submit" value="Тренировать За <?=$cena_crit?> рубинов "></a></center><?
?><a class="btn" href="my_pet">Питомец</a><?
?></div></div><?
foot();