<?
# Автор движка: InstalScript
# vk.com/k.karamin  - Я Вк
# bymas.ru/id3741  - Я на бумасе
# Специально для обитателей bymas.ru
# Ток на бумасе можно найти моды для данного движка
require_once($_SERVER['DOCUMENT_ROOT']."/instalscript/game/inc/function.php");
head("Модификация танка",$uid); # Голова
$tnk = mysql_fetch_assoc(mysql_query("SELECT * FROM `utank` WHERE `uid` = '".$uid."' AND `id` = '".abs($is['1'])."' "));


if($tnk != null){
$tk = mysql_fetch_assoc(mysql_query("SELECT * FROM `tank` WHERE `id` = '".$tnk['tid']."' "));
$cannon = round((($tk['ha']/100)*10)*$tnk['cannon']); # орудие
$gold_cannon = round((($tk['ha']/100)*50)*$tnk['cannon']); # стоимость орудия

$tower = round((($tk['ha']/100)*10)*$tnk['tower']); # башня
$gold_tower = round((($tk['ha']/100)*50)*$tnk['tower']); # стоимость башни

$caterpillar = round((($tk['ha']/100)*10)*$tnk['caterpillar']); # гусеницы
$gold_caterpillar = round((($tk['ha']/100)*50)*$tnk['caterpillar']); # стоимость за урон

$machinegun = round((($tk['ha']/100)*10)*$tnk['machinegun']); # пулемет
$gold_machinegun = round((($tk['ha']/100)*50)*$tnk['machinegun']); # стоимость за пулемет

$rockets = round((($tk['ha']/100)*10)*$tnk['rockets']); # ракеты
$gold_rockets = round((($tk['ha']/100)*50)*$tnk['rockets']); # стоимость за ракеты

$frontalarmor = round((($tk['ha']/100)*10)*$tnk['frontalarmor']); # лобовая броня
$gold_frontalarmor = round((($tk['ha']/100)*50)*$tnk['frontalarmor']); # стоимость за лобовую броню

$sidearmor = round((($tk['ha']/100)*10)*$tnk['sidearmor']); # боковая броня
$gold_sidearmor = round((($tk['ha']/100)*50)*$tnk['sidearmor']); # стоимость за боковую броню



if($is['2'] == 'cannon' && $tnk['cannon'] < '10'){
if($user['gold'] >= $gold_cannon){
mysql_query("UPDATE `utank` SET `cannon` = `cannon` + '1',`ha` = `ha` + '".$cannon."'  WHERE `id` = '".$tnk['id']."'  ");
mysql_query("UPDATE `users` SET `gold` = `gold` - '".$gold_cannon."'  WHERE `id` = '".$uid."' ");
}else{logi("Нехватает золота");}
header("Location:/modification/".$tnk['id']."/");
exit();
}

if($is['2'] == 'tower' && $tnk['tower'] < '10'){
if($user['gold'] >= $gold_tower){
mysql_query("UPDATE `utank` SET `tower` = `tower` + '1',`hb` = `hb` + '".$tower."',`ho` = `ho` + '".$tower."',`hc` = `hc` + '".$tower."' WHERE `id` = '".$tnk['id']."'  ");
mysql_query("UPDATE `users` SET `gold` = `gold` - '".$gold_tower."'  WHERE `id` = '".$uid."' ");
}else{logi("Нехватает золота");}
header("Location:/modification/".$tnk['id']."/");
exit();
}

if($is['2'] == 'caterpillar'  && $tnk['caterpillar'] < '10'){
if($user['gold'] >= $gold_caterpillar){
mysql_query("UPDATE `utank` SET `caterpillar` = `caterpillar` + '1',`ho` = `ho` + '".$caterpillar."' WHERE `id` = '".$tnk['id']."'  ");
mysql_query("UPDATE `users` SET `gold` = `gold` - '".$gold_caterpillar."'  WHERE `id` = '".$uid."' ");
}else{logi("Нехватает золота");}
header("Location:/modification/".$tnk['id']."/");
exit();
}

if($is['2'] == 'machinegun' && $tnk['machinegun'] < '10'){
if($user['gold'] >= $gold_machinegun){
mysql_query("UPDATE `utank` SET `machinegun` = `machinegun` + '1',`ha` = `ha` + '".$machinegun."' WHERE `id` = '".$tnk['id']."'  ");
mysql_query("UPDATE `users` SET `gold` = `gold` - '".$gold_machinegun."'  WHERE `id` = '".$uid."' ");
}else{logi("Нехватает золота");}
header("Location:/modification/".$tnk['id']."/");
exit();
}

if($is['2'] == 'rockets'  && $tnk['rockets'] < '10'){
if($user['gold'] >= $gold_rockets){
mysql_query("UPDATE `utank` SET `rockets` = `rockets` + '1',`ha` = `ha` + '".$rockets."' WHERE `id` = '".$tnk['id']."'  ");
mysql_query("UPDATE `users` SET `gold` = `gold` - '".$gold_rockets."'  WHERE `id` = '".$uid."' ");
}else{logi("Нехватает золота");}
header("Location:/modification/".$tnk['id']."/");
exit();
}

if($is['2'] == 'frontalarmor' && $tnk['frontalarmor'] < '10'){
if($user['gold'] >= $gold_frontalarmor){
mysql_query("UPDATE `utank` SET `frontalarmor` = `frontalarmor` + '1',`hb` = `hb` + '".$sidearmor."',`hc` = `hc` + '".$sidearmor."'  WHERE `id` = '".$tnk['id']."'  ");
mysql_query("UPDATE `users` SET `gold` = `gold` - '".$gold_frontalarmor."'  WHERE `id` = '".$uid."' ");
}else{logi("Нехватает золота");}
header("Location:/modification/".$tnk['id']."/");
exit();
}

if($is['2'] == 'sidearmor' && $tnk['sidearmor'] < '10'){
if($user['gold'] >= $gold_sidearmor){
mysql_query("UPDATE `utank` SET `sidearmor` = `sidearmor` + '1',`hb` = `hb` + '".$sidearmor."' WHERE `id` = '".$tnk['id']."'  ");
mysql_query("UPDATE `users` SET `gold` = `gold` - '".$gold_sidearmor."'  WHERE `id` = '".$uid."' ");
}else{logi("Нехватает золота");}
header("Location:/modification/".$tnk['id']."/");
exit();
}
}







echo "
<div class = 'trnt-block'>
<div class = 'wrap1'><div class = 'wrap2'><div class = 'wrap3'><div class = 'wrap4'><div class = 'wrap5'><div class = 'wrap6'><div class = 'wrap7'><div class = 'wrap8'>
<div class = 'wrap-content'>
";

echo logs();logn();

switch($is['1']){
default:
if($tnk == null){
echo "Танк не найден";
}else{
echo"<div class = 'wrap1'><div class = 'wrap2'><div class = 'wrap3'><div class = 'wrap4'><div class = 'wrap5'><div class = 'wrap6'><div class = 'wrap7'><div class = 'wrap8'>";
echo"<div class = 'wrap-content'>";

echo "<table>";
echo "
<td>
<img src = '/instalscript/images/icons/damage.jpg'>Урон <span class = 'green2'>".$my_tank['ha']."</span><br>
<img src = '/instalscript/images/icons/armor.jpg'>Броня <span class = 'green2'>".$my_tank['hb']."</span><br>
<img src = '/instalscript/images/icons/durability.jpg'>Прочность <span class = 'green2'>".$my_tank['ho']."</span><br>
<img src = '/instalscript/images/icons/accuracy.jpg'>Точность <span class = 'green2'>".$my_tank['hc']."</span><br>
</td>
";

echo "<td><div class = 'cntr'><img class = 'tank-img' src = '/tankimage_".$tnk['tid']."_1.jpg'></div></td>";
echo "</table>";
echo"</div></div></div></div></div></div></div></div></div>";






echo"<div class = 'trnt-block' w:id = 'root'>";
echo"<div class = 'wrap1'><div class = 'wrap2'><div class = 'wrap3'><div class = 'wrap4'><div class = 'wrap5'><div class = 'wrap6'><div class = 'wrap7'><div class = 'wrap8'>";
echo"<div class = 'wrap-content'>";
echo"<div class = 'mb5 inbl w100'>";

echo"<div class = 'thumb fl'><img src= '/instalscript/images/modification/o.png'><span class = 'brd_ussr'></span></div>";
echo"<div class = 'ml58 small white sh_b bold'><span class = 'green2'>Орудие</span><br>+".$cannon." к урону<br></div><div class = 'clrb'></div></div>";
echo"<div class = 'bot'>";
if($tnk['cannon'] == '10'){
echo "<span class = 'simple-but border'><span><span>Модуль улучшен</span></span></span>";
}else{
echo "<a class = 'simple-but border' w:id = 'selectLink' href = '/modification/".$tnk['id']."/cannon/'><span><span>Улучшить модуль за ".$gold_cannon." <img title = 'Золото' alt = 'Золото' src = '/instalscript/images/icons/gold.png'></span></span></a>";
}

echo "</div> ";//оружие
echo"</div></div></div></div></div></div></div></div></div></div>";



echo"<div class = 'trnt-block' w:id = 'root'> ";
echo"<div class = 'wrap1'><div class = 'wrap2'><div class = 'wrap3'><div class = 'wrap4'><div class = 'wrap5'><div class = 'wrap6'><div class = 'wrap7'><div class = 'wrap8'> ";
echo"<div class = 'wrap-content'>";
echo"<div class = 'mb5 inbl w100'>";
echo"<div class = 'thumb fl'><img src= '/instalscript/images/modification/b.png'><span class = 'brd_ussr'></span></div>";
echo"<div class = 'ml58 small white sh_b bold'><span class = 'green2'>Башня</span><br>+".$tower." к броне,прочности и точности<br></div><div class = 'clrb'></div></div>";
echo"<div class = 'bot'>";
if($tnk['tower'] == '10'){
echo "<span class = 'simple-but border'><span><span>Модуль улучшен</span></span></span>";
}else{
echo "<a class = 'simple-but border' w:id = 'selectLink' href = '/modification/".$tnk['id']."/tower/'><span><span>Улучшить модуль за ".$gold_tower." <img title = 'Золото' alt = 'Золото' src = '/instalscript/images/icons/gold.png'></span></span></a>";
}
echo "</div>"; //башня
echo"</div></div></div></div></div></div></div></div></div></div>";



echo"<div class = 'trnt-block' w:id = 'root'>";
echo"<div class = 'wrap1'><div class = 'wrap2'><div class = 'wrap3'><div class = 'wrap4'><div class = 'wrap5'><div class = 'wrap6'><div class = 'wrap7'><div class = 'wrap8'>";
echo"<div class = 'wrap-content'>";
echo"<div class = 'mb5 inbl w100'>";
echo"<div class = 'thumb fl'><img src= '/instalscript/images/modification/g.png'><span class = 'brd_ussr'></span></div>";
echo"<div class = 'ml58 small white sh_b bold'><span class = 'green2'>Гусеницы</span><br>+".$caterpillar." к прочности<br></div><div class = 'clrb'></div></div>";
echo"<div class = 'bot'>";
if($tnk['caterpillar'] == '10'){
echo "<span class = 'simple-but border'><span><span>Модуль улучшен</span></span></span>";
}else{
echo "<a class = 'simple-but border' w:id = 'selectLink' href = '/modification/".$tnk['id']."/caterpillar/'><span><span>Улучшить модуль за ".$gold_caterpillar." <img title = 'Золото' alt = 'Золото' src = '/instalscript/images/icons/gold.png'></span></span></a>";
}
echo "</div> ";//гусеницы
echo"</div></div></div></div></div></div></div></div></div></div>";



echo"<div class = 'trnt-block' w:id = 'root'>  ";
echo"<div class = 'wrap1'><div class = 'wrap2'><div class = 'wrap3'><div class = 'wrap4'><div class = 'wrap5'><div class = 'wrap6'><div class = 'wrap7'><div class = 'wrap8'> ";
echo"<div class = 'wrap-content'>";
echo"<div class = 'mb5 inbl w100'> ";
echo"<div class = 'thumb fl'><img src= '/instalscript/images/modification/p.png'><span class = 'brd_ussr'></span></div> ";
echo"<div class = 'ml58 small white sh_b bold'><span class = 'green2'>Пулемет</span><br>+".$machinegun." к урону<br></div><div class = 'clrb'></div></div> ";
echo"<div class = 'bot'>";
if($tnk['machinegun'] == '10'){
echo "<span class = 'simple-but border'><span><span>Модуль улучшен</span></span></span>";
}else{
echo "<a class = 'simple-but border' w:id = 'selectLink' href = '/modification/".$tnk['id']."/machinegun/'><span><span>Улучшить модуль за ".$gold_machinegun." <img title = 'Золото' alt = 'Золото' src = '/instalscript/images/icons/gold.png'></span></span></a>";
}
echo "</div>";//пулемет
echo"</div></div></div></div></div></div></div></div></div></div>";


echo"<div class = 'trnt-block' w:id = 'root'>";
echo"<div class = 'wrap1'><div class = 'wrap2'><div class = 'wrap3'><div class = 'wrap4'><div class = 'wrap5'><div class = 'wrap6'><div class = 'wrap7'><div class = 'wrap8'> ";
echo"<div class = 'wrap-content'>  ";
echo"<div class = 'mb5 inbl w100'>";
echo"<div class = 'thumb fl'><img src= '/instalscript/images/modification/r.png'><span class = 'brd_ussr'></span></div>";
echo"<div class = 'ml58 small white sh_b bold'><span class = 'green2'>Ракеты</span><br>+".$rockets." к урону<br></div><div class = 'clrb'></div></div>";
echo"<div class = 'bot'>";
if($tnk['rockets'] == '10'){
echo "<span class = 'simple-but border'><span><span>Модуль улучшен</span></span></span>";
}else{
echo "<a class = 'simple-but border' w:id = 'selectLink' href = '/modification/".$tnk['id']."/rockets/'><span><span>Улучшить модуль за ".$gold_rockets." <img title = 'Золото' alt = 'Золото' src = '/instalscript/images/icons/gold.png'></span></span></a>";
}
echo "</div>";//ракеты
echo"</div></div></div></div></div></div></div></div></div></div>";

echo"<div class = 'trnt-block' w:id = 'root'>";
echo"<div class = 'wrap1'><div class = 'wrap2'><div class = 'wrap3'><div class = 'wrap4'><div class = 'wrap5'><div class = 'wrap6'><div class = 'wrap7'><div class = 'wrap8'>";
echo"<div class = 'wrap-content'>";
echo"<div class = 'mb5 inbl w100'>";
echo"<div class = 'thumb fl'><img src= '/instalscript/images/modification/lb.png'><span class = 'brd_ussr'></span></div>";
echo"<div class = 'ml58 small white sh_b bold'><span class = 'green2'>Лобовая броня</span><br>+".$frontalarmor." к броне и прочности<br></div><div class = 'clrb'></div></div>";
echo"<div class = 'bot'>";
if($tnk['frontalarmor'] == '10'){
echo "<span class = 'simple-but border'><span><span>Модуль улучшен</span></span></span>";
}else{
echo "<a class = 'simple-but border' w:id = 'selectLink' href = '/modification/".$tnk['id']."/frontalarmor/'><span><span>Улучшить модуль за ".$gold_frontalarmor." <img title = 'Золото' alt = 'Золото' src = '/instalscript/images/icons/gold.png'></span></span></a>";
}
echo "</div>";//лобовая броня

echo"</div></div></div></div></div></div></div></div></div></div>";



echo"<div class = 'trnt-block' w:id = 'root'>";
echo"<div class = 'wrap1'><div class = 'wrap2'><div class = 'wrap3'><div class = 'wrap4'><div class = 'wrap5'><div class = 'wrap6'><div class = 'wrap7'><div class = 'wrap8'>";
echo"<div class = 'wrap-content'>";
echo"<div class = 'mb5 inbl w100'>";
echo"<div class = 'thumb fl'><img src= '/instalscript/images/modification/bb.png'><span class = 'brd_ussr'></span></div>";
echo"<div class = 'ml58 small white sh_b bold'><span class = 'green2'>Боковая броня</span><br>+".$sidearmor." к броне<br></div><div class = 'clrb'></div></div>";
echo"<div class = 'bot'>";
if($tnk['sidearmor'] == '10'){
echo "<span class = 'simple-but border'><span><span>Модуль улучшен</span></span></span>";
}else{
echo "<a class = 'simple-but border' w:id = 'selectLink' href = '/modification/".$tnk['id']."/sidearmor/'><span><span>Улучшить модуль за ".$gold_sidearmor." <img title = 'Золото' alt = 'Золото' src = '/instalscript/images/icons/gold.png'></span></span></a>";//боковая броня
}
echo"</div>";
echo "</div></div></div></div></div></div></div></div></div></div>";




}
echo "<div class = 'bot'><a class = 'simple-but gray mb5' href = '/angar/'><span><span>Вернуться в ангар</span></span></a></div>";
break;
}
echo "
</div>
</div></div></div></div></div></div></div></div>
</div>
";
foot($uid); # Ноги

?>