Файл: public_html/modules/forge/slot_upgrade.php
Строк: 114
<?php
$root = $_SERVER['DOCUMENT_ROOT'];
include_once ($root.'/core/base.php');
falseauth();
$header = "Улучшение слотов";
include_once ($root.'/core/head.php');
$currencyArr = ['s' => 'серебра', 'g' => 'гемов'];
if($u['head_slot_level'] == 20) $headNextLevel = 20;
else $headNextLevel = $u['head_slot_level']+1;
$headSlotUpgrade = $db->query("SELECT * FROM `slot_upgrade_levels` WHERE `level` = '".$headNextLevel."'")->fetch_object();
if($u['head_slot_level'] > 1) $headSlotCurrent = $db->query("SELECT * FROM `slot_upgrade_levels` WHERE `level` = '".$u['head_slot_level']."'")->fetch_object();
if($u['body_slot_level'] == 20) $bodyNextLevel = 20;
else $bodyNextLevel = $u['body_slot_level']+1;
$bodySlotUpgrade = $db->query("SELECT * FROM `slot_upgrade_levels` WHERE `level` = '".$bodyNextLevel."'")->fetch_object();
if($u['body_slot_level'] > 1) $bodySlotCurrent = $db->query("SELECT * FROM `slot_upgrade_levels` WHERE `level` = '".$u['body_slot_level']."'")->fetch_object();
if($u['boots_slot_level'] == 20) $bootsNextLevel = 20;
else $bootsNextLevel = $u['boots_slot_level']+1;
$bootsSlotUpgrade = $db->query("SELECT * FROM `slot_upgrade_levels` WHERE `level` = '".$bootsNextLevel."'")->fetch_object();
if($u['boots_slot_level'] > 1) $bootsSlotCurrent = $db->query("SELECT * FROM `slot_upgrade_levels` WHERE `level` = '".$u['boots_slot_level']."'")->fetch_object();
if($u['weapon_slot_level'] == 20) $weaponNextLevel = 20;
else $weaponNextLevel = $u['weapon_slot_level']+1;
$weaponSlotUpgrade = $db->query("SELECT * FROM `slot_upgrade_levels` WHERE `level` = '".$weaponNextLevel."'")->fetch_object();
if($u['weapon_slot_level'] > 1) $weaponSlotCurrent = $db->query("SELECT * FROM `slot_upgrade_levels` WHERE `level` = '".$u['weapon_slot_level']."'")->fetch_object();
if(isset($_GET['upgrade']))
{
$type = fl($_GET['type']);
if(!in_array($type, ['head', 'body', 'boots', 'weapon'])) redirect('/forge/slot_upgrade');
$typeName = $type.'_slot_level';
if($u[$typeName] == 30) redirect('/forge/slot_upgrade', 'Максимальный уровень улучшения!');
$nextLevelUpgrade = $db->query("SELECT * FROM `slot_upgrade_levels` WHERE `level` = '".($u[$typeName]+1)."'")->fetch_object();
$currArr = ['g' => 'gold', 's' => 'silver'];
if($u[$currArr[$nextLevelUpgrade->currency]] < $nextLevelUpgrade->cost) redirect('/forge/slot_upgrade', 'Недостаточно '.$currencyArr[$nextLevelUpgrade->currency].'!');
$sql = "UPDATE `users` SET `".$currArr[$nextLevelUpgrade->currency]."` = `".$currArr[$nextLevelUpgrade->currency]."` - ".$nextLevelUpgrade->cost.", `".$typeName."` = `".$typeName."` + '1' WHERE `id` = ".$u['id'];
if($u['tutorial'] == 12) $_SESSION['upgrades'] = 1;
$db->query($sql);
campaignUpdate($u['id'],2,2,1,[3],[$nextLevelUpgrade->level]);
campaignUpdate($u['id'],5,2,1,['boots',4],[$type,$nextLevelUpgrade->level]);
campaignUpdate($u['id'],6,3,1,['weapon',9],[$type,$nextLevelUpgrade->level]);
campaignUpdate($u['id'],8,2,1,['head',14],[$type,$nextLevelUpgrade->level]);
redirect('/forge/slot_upgrade', 'Улучшение успешно!');
}
echo '
<div class="b">
<table width="100%">
<tr>
<td width="10px" valign="top">
</td>
<td valign="top">
<big> <font color = "white">Шлем</font></big>
<div class="txt">
Уровень слота: '.$u['head_slot_level'].'<br>
+ к параметрам: '.($u['head_slot_level'] == 1 ? '+1' : $headSlotCurrent->buff).' ко всем параметрам<br>
</div>
</td>
</tr>
</table>
';
echo'<center>'.($u['head_slot_level'] < 20 ? '<center><a href="/forge/slot_upgrade/head/upgrade"><input type="submit"
value="Улучшить за '.$headSlotUpgrade->cost.' '.$currencyArr[$headSlotUpgrade->currency].'"></a></center>' : '<center><input type="submit" value="Максимальный уровень улучшения"></center>').' </center></div>';
echo '
<div class="b">
<table width="100%">
<tr>
<td width="10px" valign="top">
</td>
<td valign="top">
<big> <font color = "white">Броня</font></big>
<div class="txt">
Уровень слота: '.$u['body_slot_level'].'<br>
+ к параметрам: '.($u['body_slot_level'] == 1 ? '+1' : $bodySlotCurrent->buff).' ко всем параметрам<br>
</div>
</td>
</tr>
</table>
';
echo'<center>'.($u['body_slot_level'] < 20 ? '<center><a href="/forge/slot_upgrade/body/upgrade"><input type="submit" value="Улучшить за '.$bodySlotUpgrade->cost.' '.$currencyArr[$bodySlotUpgrade->currency].'"></a></center>' : '<center><input type="submit" value="Максимальный уровень улучшения"></center>').' </center></div>';
echo '
<div class="b">
<table width="100%">
<tr>
<td width="10px" valign="top">
</td>
<td valign="top">
<big> <font color = "white">Обувь</font></big>
<div class="txt">
Уровень слота: '.$u['boots_slot_level'].'<br>
+ к параметрам: '.($u['boots_slot_level'] == 1 ? '+1' : $bootsSlotCurrent->buff).' ко всем параметрам<br>
</div>
</td>
</tr>
</table>
';
echo'<center> '.($u['boots_slot_level'] < 20 ? '<center><a href="/forge/slot_upgrade/boots/upgrade"><input type="submit" value="Улучшить за '.$bootsSlotUpgrade->cost.' '.$currencyArr[$bootsSlotUpgrade->currency].'"></a></center>' : '<center><input type="submit" value="Максимальный уровень улучшения"></center>').' </center></div>';
echo '
<div class="b">
<table width="100%">
<tr>
<td width="10px" valign="top">
</td>
<td valign="top">
<big> <font color = "white">Оружие</font></big>
<div class="txt">
Уровень слота: '.$u['weapon_slot_level'].'<br>
+ к параметрам: '.($u['weapon_slot_level'] == 1 ? '+1' : $weaponSlotCurrent->buff).' ко всем параметрам<br>
</div>
</td>
</tr>
</table>
';
echo'<center> '.($u['weapon_slot_level'] < 20 ? '<center><a href="/forge/slot_upgrade/weapon/upgrade"><input type="submit" value="Улучшить за '.$weaponSlotUpgrade->cost.' '.$currencyArr[$weaponSlotUpgrade->currency].'"></a></center>' : '<center><input type="submit" value="Максимальный уровень улучшения"></center>').' </center></div>';
echo"<center><a class = 'link' href = '/forge'>Назад</a></center>";
include_once ($root.'/core/foot.php');