View file sdark.mobi/clan/tower.php

File size: 3.7Kb
<?php
require_once '../core/system.php';
echo only_reg();
echo ban();
if (isset($_GET['id']) && mysql_result(mysql_query("SELECT COUNT(*) FROM `clan` WHERE `id` = '".intval($_GET['id'])."'"),0) == true){
$clan = mysql_fetch_array(mysql_query("SELECT * FROM `clan` WHERE `id`  = ".intval($_GET['id']).""));
}else{
$_SESSION['err'] = "Ошибка";
header('Location: /');
exit();
}
$header = 'Постройки / Башня Мудрости';
require_once H.'core/head.php';

if($clan['tower']==1){$st=500; $gold=1; $rating=100;}
if($clan['tower']==2){$st=1100; $gold=2; $rating=150;}
if($clan['tower']==3){$st=2700; $gold=3; $rating=200;}
if($clan['tower']==4){$st=6000; $gold=4; $rating=250;}
if($clan['tower']==5){$st=11000; $gold=5; $rating=300;}
if($clan['tower']==6){$st=19000; $gold=6; $rating=350;}
if($clan['tower']==7){$st=28000; $gold=7; $rating=400;}
if($clan['tower']==8){$st=38000; $gold=8; $rating=450;}
if($clan['tower']==9){$st=50000; $gold=9; $rating=500;}
if($clan['tower']==10){$st=65000; $gold=10; $rating=550;}
if($clan['tower']==11){$st=82000; $gold=11; $rating=600;}
if($clan['tower']==12){$st=125000; $gold=12; $rating=650;}
if($clan['tower']==13){$st=160000; $gold=13; $rating=700;}
if($clan['tower']==14){$st=210000; $gold=14; $rating=750;}
if($clan['tower']==15){$gold=15; $rating=800;}
$st=floor($st*0.80);

if(isset($_GET['level'])){
$d = $clan['tower']+1;
$goldd = $st*100;
if($clan['gold'] < $goldd){
header("Location: ?id=".$clan['id']."");
$_SESSION['err'] = 'Недостаточно золота';
exit;
}
if($user['dolz']!='основатель'){
$_SESSION['err'] = 'Ошибка';
header('Location: ?id='.$clan['id'].'');
exit();
}
if($clan['tower'] > 14){
$_SESSION['err'] = 'Ошибка';
header('Location: ?id='.$clan['id'].'');
exit();
}
$gold = $clan['gold'] - $goldd;
$t = time();
mysql_query("INSERT INTO `zur` set `kto` = ".$user['id'].", `name` = 'улучшил башню мудрости', `time` = '".$t."', `clan`='".$user['clan']."'");
mysql_query("UPDATE `clan` SET `gold`='".$gold."', `tower`='".$d."'  WHERE `id`='".$user['clan']."'");
header("Location: ?id=".$clan['id']."");
$_SESSION['message'] = "<font color='94ED18'> Башня Мудрости повышена до ".$d." уровня </font>";

}
?>
<div class='foot'>
<img src='/images/clan/tower.png' height='30' width='30'>
<font color='EBC958'> Башня Мудрости </font>
<font color='#CDC9C9'>(<?=$clan['tower']?> ур.)</div></font>
<hr>
<div class='mli'>
<div class='empty2'></div>
<font color='ECE999'>От уровня постройки зависит количество золота и рейтинга, которое получат игроки при победе в наступлениях.</font>
<div class='empty2'></div></div>
<hr> 
<?php
if($clan['tower'] < 12 and $user['clan']==$clan['id'] and $user['dolz']=='основатель'){
?>
<div class='but-list'>
<a href='?id=<?=$clan['id']?>&level'><img src='/images/icon/level.png'> Повысить уровень 
<font color='#CDC9C9'>за <img src="/images/icon/gold.png"><?=$st?> (<font color='F2F745'>-20%</font>)
<font color='orange'>(+1<img src="/images/icon/gold.png">, +50<img src="/images/icon/rating_<?=$clan['plem']?>.png">)</font></font>
</a></div>
<hr>
<?php
}//(<font color='F2F745'>-20%</font>)
if($clan['tower'] > 11 and $user['clan']==$clan['id']){
echo"<div class='foot'> Алтарь максимального уровня </div>
<hr>";
}
?>
<div class='foot'>
<font color='E1B63F'>Бонус постройки: каждому <font color='#B1DF3D'><?=$gold?></font><img src='/images/icon/gold.png'> и <font color='#B1DF3D'><?=$rating?></font><img src="/images/icon/rating_<?=$clan['plem']?>.png">на всех
</font>
</div>
<?php
require_once H.'core/foot.php';
?>