Файл: pages/economy/smith.php
Строк: 911
<?php
// Physical module map v50.6: public URL stays clean while code lives in /pages.
if (!defined('GAME_ROOT')) define('GAME_ROOT', dirname(__DIR__, 2));
chdir(GAME_ROOT);
if (PHP_SAPI !== 'cli') { $_SERVER['PHP_SELF']='/smith.php'; $_SERVER['SCRIPT_NAME']='/smith.php'; }
/* Обновление игры под PHP 8.4 / PDO и усиление безопасности: by Метриум (Стэлп) */
include './system/common.php';
include './system/functions.php';
include './system/user.php';
include './system/menu.php';
include './system/class.Item.php';
if(!$user) {
header('location: /');
exit;
}
$acrions = htmlspecialchars((string)($_GET['action'] ?? ''), ENT_QUOTES, 'UTF-8');
switch($acrions) {
default:
$title = 'Кузница';
include './system/h.php';
?>
<div class='center'><div class='block_zero'><span class='blue'>В кузнице можно улучшить свое снаряжение</span></div></div><div class='mini-line'></div><div class='center'><div class='block_zero'><img src='/images/town/hd/smith.jpg' width='100%' alt=''/></div></div><div class='mini-line'></div>
<div class='menuList'>
<li><a href='/smith/runes/'><img src='/images/icon/rune.png' alt='*'/>Торговец рунами </li></a>
<li><a href='/smith/smith/'><img src='/images/icon/smith.png' alt='*'/>Заточка вещей </a></li>
<li><a href='/smith/bonus/'><img src='/images/icon/smith.png' alt='*'/>Бонус вещей </li></a>
<li><a href='/amulet/'><img src='/images/icon/smith.png' alt='*'/>Амулет </li></a>
<li><a href='/item-stars/'><img src='/images/icon/quest.png' alt='*'/>Звезды <small>Прокачка звезд</small></a></li>
<li><a href='/rings/'><img src='/images/icon/equip.png' alt='*'/>Кольца <small>Магические умения</small></a></li>
<li><a href='/seal/'><img src='/images/icon/smith.png' alt='*'/>Печати </a></li>
</div>
<?php
include './system/f.php';
break;
case 'runes':
$title = 'Торговец рунами';
include './system/h.php';
$skidka = db_fetch_array(db_query('SELECT * FROM `skilka` WHERE `id` = 3'));
if(!is_array($skidka) || (int)($skidka['time']??0)<=time()) $skidka=['zena'=>0,'time'=>0];
$sk = $skidka['zena'];
echo '<div class="main">';
$_listGet = array(1 => 75, 2 => 150, 3 => 250, 4 => 600, 5 => 1000, 6 => 2000);
$id = _string(_num($_GET['id'] ?? 0));
if($id) {
$inv = db_query('SELECT * FROM `inv` WHERE `user` = "'.$user['id'].'" AND `id` = "'.$id.'" AND `rune` < 6');
$inv = db_fetch_array($inv);
if(!$inv) {
header('location: /smith/runes/');
exit;
}
$item = db_query('SELECT * FROM `items` WHERE `id` = "'.$inv['item'].'"');
$item = db_fetch_array($item);
switch($item['w']) {
case 1:
$rune_stat = 'str';
$stat = 'силе';
break;
case 2:
$rune_stat = 'vit';
$stat = 'жизни';
break;
case 3:
$rune_stat = 'def';
$stat = 'броне';
break;
case 4:
$rune_stat = 'agi';
$stat = 'удаче';
break;
case 5:
$rune_stat = 'str';
$stat = 'силе';
break;
case 6:
$rune_stat = 'str';
$stat = 'силе';
break;
case 7:
$rune_stat = 'def';
$stat = 'броне';
break;
case 8:
$rune_stat = 'vit';
$stat = 'жизни';
break;
case 9:
$rune_stat = 'vit';
$stat = 'жизни';
break;
}
$rune = _string(_num($_GET['rune'] ?? 0));
if($rune && $rune > 0 && $rune < 7) {
switch($rune) {
case 1:
$cost = 175;
$rune_stats = 75;
break;
case 2:
$cost = 1400;
$rune_stats = 150;
break;
case 3:
$cost = 16000;
$rune_stats = 250;
break;
case 4:
$cost = 20000;
$rune_stats = 600;
break;
case 5:
$cost = 35000;
$rune_stats = 1000;
break;
case 6:
$cost = 70000;
$rune_stats = 2000;
break;
}
$cost -= round(($cost / 100)*($sk));
if($cost && $inv['rune'] < $rune && $user['g'] >= $cost) {
$_arrq = array(1 => 75, 2=> 150, 3=> 250, 4=> 600, 5=> 1000, 6 => 2000);
if($inv['rune'] > 0) {
$oldRuneDelta=(int)$_arrq[$inv['rune']];
db_query('UPDATE `inv` SET `_'.$rune_stat.'` = `_'.$rune_stat.'` - '.$oldRuneDelta.', `rune` = "0" WHERE `id` = "'.$inv['id'].'"');
if((int)$inv['equip']===1){ db_query('UPDATE `users` SET `'.$rune_stat.'`=`'.$rune_stat.'`-'.$oldRuneDelta.' WHERE `id`='.(int)$user['id']); }
exit(header('Location: /smith/runes/'.$inv['id'].'/'.($inv['rune'] + 1).'/'));
}else{
db_query('UPDATE `inv` SET `_'.$rune_stat.'` = `_'.$rune_stat.'` + '.(int)$rune_stats.', `rune` = "'.$rune.'" WHERE `id` = "'.$inv['id'].'"');
if((int)$inv['equip']===1){ db_query('UPDATE `users` SET `'.$rune_stat.'`=`'.$rune_stat.'`+'.(int)$rune_stats.' WHERE `id`='.(int)$user['id']); }
db_query('UPDATE `users` SET `g` = `g` - '.(int)$cost.' WHERE `id` = '.(int)$user['id']);
exit(header('Location: /smith/runes/'.$inv['id'].'/'));
}
}
else
{
}
}
?>
<div class='block_zero'>
<table cellpadding='0' cellspacing='0'>
<tr>
<td><img src='/itemImage.php?id=<?=$item['id']?>&smith=<?=$inv['smith']?>' alt='*'/></td>
<td valign='top' style='padding-left: 5px;'><img src='/images/icon/quality/<?=$item['quality']?>.png' alt="*"/> <a href='/item/<?=$inv['id']?>/'><?=$item['name']?></a><br/>
<?php
if($inv['rune'] > 0) {
?>
<img src='/images/icon/rune.png' alt='*'/> Руна: <?=($inv['rune'] ? '<img src="/images/icon/quality/'.$inv['rune'].'.png" alt="*"/> <font color="#9c9">+'.$_listGet[$inv['rune']].'</font> '.$stat:'<font color="#999">отсутствует</font>')?><br/>
<?php
}
?>
</td></tr></table>
</div><div class='mini-line'></div>
<div class='block_zero'>
<?php
for($i = 1; $i < 7; $i++) {
switch($i) {
case 1:
$quality = 'Обычное качество';
$quality_color = "#6c3";
$cost = 175;
$rune_stats = 75;
break;
case 2:
$quality = 'Редкое качество';
$quality_color = "#69c";
$cost = 1400;
$rune_stats = 150;
break;
case 3:
$quality = 'Эпическое качество';
$quality_color = "#c6f";
$cost = 16000;
$rune_stats = 250;
break;
case 4:
$quality = 'Легендарное качество';
$quality_color = "#f60";
$cost = 20000;
$rune_stats = 600;
break;
case 5:
$quality = 'Божественное качество';
$quality_color = "#999";
$cost = 35000;
$rune_stats = 1000;
break;
case 6:
$quality = 'Мифическое качество';
$quality_color = "#999";
$cost = 70000;
$rune_stats = 2000;
break;
}
$cost -= round(($cost / 100)*($sk));
if($inv['rune'] < $i) {
?>
<table cellpadding='0' cellspacing='0'>
<tr>
<td><img src='/images/runes/<?=$rune_stat?>.png' alt='*'/></td>
<td valign='top' style='padding-left: 5px;'><img src='/images/icon/quality/<?=$i?>.png' alt='*'/> <font color='<?=$quality_color?>'><?=$quality?></font>
<br/>
Бонус: <img src='/images/icon/<?=$rune_stat?>.png' alt='*'/> <font color='#9c9'>+<?=$rune_stats?></font> к <?=$stat?>
</td></tr></table>
<br/>
<div align='center'>
<a class='btn' href='/smith/runes/<?=$inv['id']?>/<?=$i?>'><span class='end'><span class='label'>Купить за <img src='/images/icon/gold.png' alt='*'/> <?=$cost?> золота</span></span></a>
</div>
<?php
}
}
?>
</div>
<?php
}
else
{
?>
<div class='block_zero'>
<center><img src='/images/town/rune.png' alt='*'/><br>
<center><font color='#9bc'>Магические свойства рун улучшат ваши вещи!</font></center>
</div><div class='mini-line'></div>
<?php
$items = (int)(db_result(db_query('SELECT COUNT(*) FROM `inv` WHERE `user` = "'.$user['id'].'" AND `rune` < 6'),0) ?: 0);
if($items > 0) {
?>
<div class='block_zero'>
<?php
$q = db_query('SELECT * FROM `inv` WHERE `user` = "'.$user['id'].'" AND `rune` < 7');
while($row = db_fetch_array($q)) {
$item = db_query('SELECT * FROM `items` WHERE `id` = "'.$row['item'].'"');
$item = db_fetch_array($item);
$runeLabels=[1=>'силе',2=>'жизни',3=>'броне',4=>'удаче',5=>'силе',6=>'силе',7=>'броне',8=>'жизни',9=>'жизни'];
$stat=$runeLabels[(int)($item['w']??0)] ?? 'параметрам';
?>
<table cellpadding='0' cellspacing='0'>
<tr>
<td><img src='/itemImage.php?id=<?=$row['item']?>&smith=<?=$row['smith']?>' alt='*'/></td>
<td valign='top' style='padding-left: 5px;'><img src='/images/icon/quality/<?=$item['quality']?>.png' alt='*'/> <a href='/item/<?=$row['id']?>/'><?=$item['name']?></a> <small class='grey'><?=((int)$row['equip']===1?'надето':'в сумке')?></small>
<?php
switch($item['quality']) {
case 0:
$bonus = 0;
$quality = 'Простой';
$quality_color = "#986";
break;
case 1:
$bonus = 5;
$quality = 'Обычный';
$quality_color = "#6c3";
break;
case 2:
$bonus = 10;
$quality = 'Редкий';
$quality_color = "#69c";
break;
case 3:
$bonus = 15;
$quality = 'Эпический';
$quality_color = "#c6f";
break;
case 4:
$bonus = 20;
$quality = 'Легенарный';
$quality_color = "#f60";
break;
case 5:
$bonus = 50;
$quality = 'Божественный';
$quality_color = "#999";
break;
case 6:
$bonus = 100;
$quality = 'Сверх Божественный';
$quality_color = "#999";
break;
}
$bonus = game_item_bonus_max((int)$item['quality']);
?>
<br/>
<small><font color="<?=$quality_color?>"><?=$quality?> [<?=$row['bonus']?>/<?=$bonus?>]</font></small>
<?php
if($row['rune'] > 0) {
?>
<br /><img src='/images/icon/rune.png' alt='*'/> Руна: <img src="/images/icon/quality/<?=$row['rune'];?>.png" alt="*"/> <font color="#9c9">+<?=$_listGet[$row['rune']];?></font> <?=$stat;?><br/>
<?php
}
?>
</td></tr></table><br/>
<center>
<a class='btn' href='/smith/runes/<?=$row['id']?>'><span class='end'><span class='label'>Выбрать</span></span></a></center>
<?php
}
?>
</div>
<?php
}
else
{
?>
<div class='block_zero' align='center'>
У вас нет подходящих вещей для установки или улучшения руны<br/>
Вещи можно купить в <img src='/images/icon/equip.png' alt='*'/> <a>Магазине</a><br/><br/>
<a href='/shop'>Магазин снаряжения</a>
<?php
}
}
echo '</div>';
include './system/f.php';
break;
case 'bonus':
$title = 'Увеличение бонуса вещей';
include './system/h.php';
if (isset($_SESSION['ok'])){
echo "<div class='ok'><center><img src='/images/icon/ok.png'>".$_SESSION['ok']."</center></div>";
$_SESSION['ok']=NULL;
}
if (isset($_SESSION['err'])){
echo "<div class='error'><center><img src='/images/icon/error.png'>".$_SESSION['err']."</center></div>";
$_SESSION['err']=NULL;
}
$skidka = db_fetch_array(db_query('SELECT * FROM `skilka` WHERE `id` = 5'));
if(!is_array($skidka) || (int)($skidka['time']??0)<=time()) $skidka=['zena'=>0,'time'=>0];
$sk = $skidka['zena'];
echo '<div class="main">';
$id = _string(_num($_GET['id'] ?? 0));
if($id) {
$inv = db_query('SELECT * FROM `inv` WHERE `user` = "'.$user['id'].'" AND `id` = "'.$id.'"');
$inv = db_fetch_array($inv);
if(!$inv) {
header('location: /');
exit;
}
$item = db_query('SELECT * FROM `items` WHERE `id` = "'.$inv['item'].'"');
$item = db_fetch_array($item);
switch($item['quality']) {
case 0:
$bonus = 0;
$quality = 'Простой';
$quality_color = "#986";
$cost = 0;
break;
case 1:
$bonus = 5;
$quality = 'Обычный';
$quality_color = "#6c3";
if($inv['bonus'] == 0) {
$cost = 5;
}
else
{
$cost = $inv['bonus'] * 5;
}
break;
case 2:
$bonus = 10;
$quality = 'Редкий';
$quality_color = "#69c";
if($inv['bonus'] == 0) {
$cost = 5;
}
else
{
$cost = $inv['bonus'] * 5;
}
break;
case 3:
$bonus = 15;
$quality = 'Эпический';
$quality_color = "#c6f";
if($inv['bonus'] == 10) {
$cost = 100;
}
else
{
$cost = ($inv['bonus'] - 10) * 100;
}
break;
case 4:
$bonus = 20;
$quality = 'Легенарный';
$quality_color = "#f60";
if($inv['bonus'] == 10) {
$cost = 100;
}
else
{
$cost = ($inv['bonus'] - 10) * 100;
}
break;
case 5:
$bonus = 50;
$quality = 'Божественный';
$quality_color = "#999";
if($inv['bonus'] == 10) {
$cost = 100;
}
else
{
$cost = ($inv['bonus'] - 10) * 100;
}
break;
case 6:
$bonus = 100;
$quality = 'Сверх Божественный';
$quality_color = "#999";
if($inv['bonus'] == 10) {
$cost = 100;
}
else
{
$cost = 100 + ($inv['bonus'] - 10) * 100;
}
break;
}
$bonus = game_item_bonus_max((int)$item['quality']);
// Стартовый бонус не меняется; повышаем только потолок прокачки.
$cost = max(5, ((int)$inv['bonus'] < 10 ? 5 + (int)$inv['bonus'] * 5 : 100 + ((int)$inv['bonus'] - 10) * 100));
$cost -= round(($cost / 100)*($sk));
if((int)$inv['bonus'] >= $bonus) {
header('location: /smith/bonus/');
exit;
}
?>
<div class='block_zero'>
<table cellpadding='0' cellspacing='0'>
<tr>
<td><img src='/itemImage.php?id=<?=$item['id']?>&smith=<?=$inv['smith']?>' alt='*'/></td>
<td valign='top' style='padding-left: 5px;'><img src='/images/icon/quality/<?=$item['quality']?>.png' alt="*"/> <a href='/item/<?=$inv['id']?>/'><?=$item['name']?></a><br/>
<small><font color="<?=$quality_color?>"><?=$quality?> [<?=$inv['bonus']?>/<?=$bonus?>]</font></small>
</td></tr></table>
</div><div class='mini-line'></div>
<div class='block_zero'>
<img src='/images/icon/quality/<?=$item['quality']?>.png' alt="*"/> Бонус вещи: [<?=$inv['bonus']?>/<?=$bonus?>]
</div>
<?php
$doBonus=(($_SERVER['REQUEST_METHOD']??'GET')==='POST' && isset($_POST['do_bonus']));
if($doBonus){ security_require_csrf(); }
if($doBonus && (int)$user['g'] >= $cost) {
$_bonus = 0;
switch($item['quality']) {
case 0:
$_bonus += 4.0;
break;
case 1:
$_bonus += 4.8;
break;
case 2:
$_bonus += 6;
break;
case 3:
$_bonus +=6.8;
break;
case 4:
$_bonus += 8;
break;
case 5:
$_bonus += 16;
break;
case 6:
$_bonus += 16;
break;
}
if($doBonus && (int)$user['g'] >= $cost) {
$_SESSION['ok'] = '+ 5% к параметрам';
db_query('UPDATE `users` SET `g` = "'.($user['g'] - $cost).'" WHERE `id` = "'.$user['id'].'"');
db_query('UPDATE `inv` SET `bonus` = `bonus` + 1,
`_str` = "'.($inv['_str'] + $_bonus).'",
`_vit` = "'.($inv['_vit'] + $_bonus).'",
`_agi` = "'.($inv['_agi'] + $_bonus).'",
`_def` = "'.($inv['_def'] + $_bonus).'" WHERE `id` = "'.$inv['id'].'"');
header('location: /smith/bonus/'.$inv['id'].'/');
if((int)$inv['equip'] === 1) { db_query('UPDATE `users` SET `str`=`str`+'.(float)$_bonus.',`vit`=`vit`+'.(float)$_bonus.',`agi`=`agi`+'.(float)$_bonus.',`def`=`def`+'.(float)$_bonus.' WHERE `id`='.(int)$user['id']); header('location: /smith/bonus/'.$inv['id'].'/'); exit; }
}
}
?>
<div class='mini-line'></div>
<div class='block_zero' align='center'>
<form method='post' action='/smith/bonus/<?=$id?>/' class='inline-form'>
<?=security_csrf_field()?>
<button class='btn' type='submit' name='do_bonus' value='1'><span class='end'><span class='label'>Улучшить за <img src='/images/icon/gold.png' alt='*'/> <?=n_f((int)$cost)?></span></span></button>
</form>
</div>
<?php
}
else
{
?>
<div class='block_zero' align='center'>
<font color='#9bc'>Каждая единица бонуса дает +5% к параметрам вещи</font>
</div><div class='mini-line'></div>
<?php
$q = db_query('SELECT * FROM `inv` WHERE `user` = "'.$user['id'].'"');
$items = db_result($q,0);
if($items > 0) {
?>
<div class='block_center'>
<?php
$i = 0;
$q = db_query('SELECT * FROM `inv` WHERE `user` = "'.$user['id'].'"');
while($row = db_fetch_array($q)) {
$item = db_query('SELECT * FROM `items` WHERE `id` = "'.$row['item'].'"');
$item = db_fetch_array($item);
switch($item['quality']) {
case 0:
$bonus = 0;
$quality = 'Простой';
$quality_color = "#986";
break;
case 1:
$bonus = 5;
$quality = 'Обычный';
$quality_color = "#6c3";
break;
case 2:
$bonus = 10;
$quality = 'Редкий';
$quality_color = "#69c";
break;
case 3:
$bonus = 15;
$quality = 'Эпический';
$quality_color = "#c6f";
break;
case 4:
$bonus = 20;
$quality = 'Легенарный';
$quality_color = "#f60";
break;
case 5:
$bonus = 50;
$quality = 'Божественный';
$quality_color = "#999";
break;
case 6:
$bonus = 100;
$quality = 'Сверх Божественный';
$quality_color = "#999";
break;
}
if($row['bonus'] < $bonus) {
$i++;
?>
<table cellpadding='0' cellspacing='0'>
<tr>
<td><img src='/itemImage.php?id=<?=$row['item']?>&smith=<?=$row['smith']?>' alt='*'/></td>
<td valign='top' style='padding-left: 5px;'><img src='/images/icon/quality/<?=$item['quality']?>.png' alt='*'/> <a href='/item/<?=$row['id']?>/'><?=$item['name']?></a> <small class='grey'><?=((int)$row['equip']===1?'надето':'в сумке')?></small>
<br/>
<small><font color="<?=$quality_color?>"><?=$quality?> [<?=$row['bonus']?>/<?=$bonus?>]</font></small>
</td></tr></table><br/>
<div align='center'><a class='btn' href='/smith/bonus/<?=$row['id']?>/'><span class='end'><span class='label'>Выбрать</a></span></span></div>
<?php
}
}
if($i == 0) {
?>
<center><font color='#909090'>Подходящих вещей нет </font></center>
<?php
}
?>
</div>
<?php
}
else
{
?>
<div class='block_zero' align='center'>
<font color='#999'>Подходящих вещей нет !</font>
</div>
<?php
}
}
echo '</div>';
include './system/f.php';
break;
case 'smith':
$title = 'Повышение заточки';
include './system/h.php';
echo '<div class="main">';
if (isset($_SESSION['err'])){
echo "<div class='error'><center><img src='/images/icon/error.png'>".$_SESSION['err']."</center></div>";
$_SESSION['err']=NULL;
}
if (isset($_SESSION['ok'])){
echo "<div class='ok'><center><img src='/images/icon/ok.png'>".$_SESSION['ok']."</center></div>";
$_SESSION['ok']=NULL;
}
$id = _string(_num($_GET['id'] ?? 0));
if($id) {
$inv = db_query('SELECT * FROM `inv` WHERE `user` = "'.$user['id'].'" AND `id` = "'.$id.'" AND `smith` < 50');
$inv = db_fetch_array($inv);
if(!$inv) {
header('location: /smith/smith/');
exit;
}
$item = db_query('SELECT * FROM `items` WHERE `id` = "'.$inv['item'].'"');
$item = db_fetch_array($item);
switch($item['quality']) {
case 0:
$bonus = 0;
$quality = 'Простой';
$quality_color = "#986";
break;
case 1:
$bonus = 5;
$quality = 'Обычный';
$quality_color = "#6c3";
break;
case 2:
$bonus = 10;
$quality = 'Редкий';
$quality_color = "#69c";
break;
case 3:
$bonus = 15;
$quality = 'Эпический';
$quality_color = "#c6f";
break;
case 4:
$bonus = 20;
$quality = 'Легенарный';
$quality_color = "#f60";
break;
case 5:
$bonus = 50;
$quality = 'Божественный';
$quality_color = "#999";
break;
case 6:
$bonus = 100;
$quality = 'Сверх Божественный';
$quality_color = "#999";
break;
}
switch($inv['smith']) {
case 0:
$chanse = 100;
$smith = 24;
break;
case 1:
$chanse = 98;
$smith = 28;
break;
case 2:
$chanse = 96;
$smith = 32;
break;
case 3:
$chanse = 95;
$smith = 36;
break;
case 4:
$chanse = 90;
$smith = 40;
break;
case 5:
$chanse = 89;
$smith = 44;
break;
case 6:
$chanse = 88;
$smith = 48;
break;
case 7:
$chanse = 87;
$smith = 52;
break;
case 8:
$chanse = 86;
$smith = 56;
break;
case 9:
$chanse = 55;
$smith = 60;
break;
case 10:
$chanse = 85;
$smith = 64;
break;
case 11:
$chanse = 84;
$smith = 68;
break;
case 12:
$chanse = 83;
$smith = 72;
break;
case 13:
$chanse = 82;
$smith = 76;
break;
case 14:
$chanse = 80;
$smith = 80;
break;
case 15:
$chanse = 79;
$smith = 84;
break;
case 16:
$chanse = 78;
$smith = 88;
break;
case 17:
$chanse = 77;
$smith = 92;
break;
case 18:
$chanse = 76;
$smith = 96;
break;
case 19:
$chanse = 75;
$smith =100;
break;
case 20:
$chanse = 74;
$smith = 124;
break;
case 21:
$chanse = 70;
$smith = 150;
break;
case 22:
$chanse = 68;
$smith = 155;
break;
case 23:
$chanse = 66;
$smith = 160;
break;
case 24:
$chanse = 64;
$smith = 170;
break;
case 25:
$chanse = 62;
$smith = 189;
break;
case 26:
$chanse = 60;
$smith = 190;
break;
case 27:
$chanse = 58;
$smith = 201;
break;
case 28:
$chanse = 58;
$smith = 205;
break;
case 29:
$chanse = 56;
$smith = 209;
break;
case 30:
$chanse = 54;
$smith = 250;
break;
case 31:
$chanse = 52;
$smith = 255;
break;
case 32:
$chanse = 50;
$smith = 260;
break;
case 33:
$chanse = 48;
$smith = 261;
break;
case 34:
$chanse = 44;
$smith = 265;
break;
case 35:
$chanse = 42;
$smith = 266;
break;
case 36:
$chanse = 40;
$smith = 268;
break;
case 37:
$chanse = 39;
$smith = 270;
break;
case 38:
$chanse = 38;
$smith = 272;
break;
case 39:
$chanse = 35;
$smith = 250;
break;
case 40:
$chanse = 30;
$smith = 274;
break;
case 41:
$chanse = 27;
$smith = 275;
break;
case 42:
$chanse = 24;
$smith = 276;
break;
case 43:
$chanse = 20;
$smith = 277;
break;
case 44:
$chanse = 18;
$smith = 279;
break;
case 45:
$chanse = 14;
$smith = 281;
break;
case 46:
$chanse = 12;
$smith = 285;
break;
case 47:
$chanse = 10;
$smith = 286;
break;
case 48:
$chanse = 7;
$smith = 291;
break;
case 49:
$chanse = 5;
$smith = 295;
break;
case 50:
$chanse = 54;
$smith = 300;
break;
}
$res_1 = 1 + $inv['smith'];
$res_2 = 2 + ($inv['smith'] * 2);
$res_3 = 2 + ($inv['smith'] * 2);
$res_4 = 2 + ($inv['smith'] * 2);
$res_5 = 2 + ($inv['smith'] * 2);
$s = 1000 + ($inv['smith'] * 1000);
$sack = db_query('SELECT * FROM `sack` WHERE `user` = "'.$user['id'].'"');
$sack = db_fetch_array($sack);
if($_GET['start'] == true) {
if((time() - $_SESSION['time']) < 1)
{
$_SESSION['err']="<center>Не так быстро!!!</center>";
header("Location: ?");
exit();
}
$_SESSION['time'] = time();
if($sack[1] < $res_1 OR $sack[2] < $res_2 OR $sack[3] < $res_3 OR $sack[4] < $res_4 OR $sack[5] < $res_5 OR $user['s'] < $s) {
header('location: /smith/smith/'.$inv['id'].'/');
exit;
}
db_query('UPDATE `sack` SET `1` = `1` - '.$res_1.',
`2` = `2` - '.$res_2.',
`3` = `3` - '.$res_3.',
`4` = `4` - '.$res_4.',
`5` = `5` - '.$res_5.' WHERE `user` = "'.$user['id'].'"');
db_query('UPDATE `users` SET `s` = `s` - '.$s.' WHERE `id` = "'.$user['id'].'"');
?>
<div class='block_zero'>
<?php
if(rand(1,100) < $chanse) {
db_query('UPDATE `inv` SET `smith` = `smith` + 1,
`_str` = "'.($inv['_str'] + $smith).'",
`_vit` = "'.($inv['_vit'] + $smith).'",
`_agi` = "'.($inv['_agi'] + $smith).'",
`_def` = "'.($inv['_def'] + $smith).'" WHERE `id` = "'.$inv['id'].'"');
header('location: /smith/smith/'.$inv['id'].'/');
if($inv['equip'] == 1) {
db_query('UPDATE `users` SET `str` = `str` + "'.($inv['str'] + $smith).'",
`vit` = `vit` + "'.($inv['vit'] + $smith).'",
`agi` = `agi` + "'.($inv['agi'] + $smith).'",
`def` = `def` + "'.($inv['def'] + $smith).'" WHERE `id` = ''.$user['id'].''');
header('location: /smith/smith/'.$inv['id'].'/');
}
if($inv['smith'] > 0) {
$smith += 24;
}
if($inv['smith'] > 1) {
$smith += 28;
}
if($inv['smith'] > 2) {
$smith += 32;
}
if($inv['smith'] > 3) {
$smith += 36;
}
if($inv['smith'] > 4) {
$smith += 40;
}
if($inv['smith'] > 5) {
$smith += 44;
}
if($inv['smith'] > 6) {
$smith += 48;
}
if($inv['smith'] > 7) {
$smith += 52;
}
if($inv['smith'] > 8) {
$smith += 56;
}
if($inv['smith'] > 9) {
$smith += 60;
}
if($inv['smith'] > 10) {
$smith += 64;
}
if($inv['smith'] > 11) {
$smith += 68;
}
if($inv['smith'] > 12) {
$smith += 72;
}
if($inv['smith'] > 13) {
$smith += 76;
}
if($inv['smith'] > 14) {
$smith += 80;
}
if($inv['smith'] > 15) {
$smith += 84;
}
if($inv['smith'] > 16) {
$smith += 88;
}
if($inv['smith'] > 17) {
$smith += 92;
}
if($inv['smith'] > 18) {
$smith += 96;
}
if($inv['smith'] > 19) {
$smith += 100;
}
if($inv['smith'] > 20) {
$smith += 124;
}
$_SESSION['ok'] = '<font color='#90c090'><b>Удача!</b></font>
<div class='separator'></div>
Вещь заточилась<br/>
<font color='#90c090'>+ '.$smith.'</font> к параметрам вещи';
}
else
{
$_SESSION['err'] = '<b>Неудача!</b><br/>';
}
}
else
{
}
if(isset($_GET['start2'])) {
$damokejimas = false;
if ($user['s'] >= $s && ($sack[1] < $res_1 or $sack[2] < $res_2 or $sack[3] < $res_3 or $sack[4] < $res_4 or $sack[5] < $res_5)) {
$damokejimas = true;
}
$kiek_primoketi = 0;
if ($sack[1] < $res_1) {
$kiek_primoketi += ($res_1 - $sack[1]) * 25;
}
if ($sack[2] < $res_2) {
$kiek_primoketi += ($res_2 - $sack[2]) * 25;
}
if ($sack[3] < $res_3) {
$kiek_primoketi += ($res_3 - $sack[3]) * 25;
}
if ($sack[4] < $res_4) {
$kiek_primoketi += ($res_4 - $sack[4]) * 25;
}
if ($sack[5] < $res_5) {
$kiek_primoketi += ($res_5 - $sack[5]) * 25;
}
if($user['g'] < $kiek_primoketi){
$_SESSION['err']="Не хватает <font color='#FFFF00'><img src='/images/icon/gold.png' alt='*'/> ".($kiek_primoketi - $user['g'])." золота</font>";
header('location: /smith/smith/'.$inv['id'].'/?');
exit;
}
$user['s'] = $user['s'] - $s;
if ($damokejimas == true){
db_query('UPDATE `sack` SET
`1` = `1` - '.(($sack[1] >= $res_1) ? $res_1 : $sack[1]).',
`2` = `2` - '.(($sack[2] >= $res_2) ? $res_2 : $sack[2]).',
`3` = `3` - '.(($sack[3] >= $res_3) ? $res_3 : $sack[3]).',
`4` = `4` - '.(($sack[4] >= $res_4) ? $res_4 : $sack[4]).',
`5` = `5` - '.(($sack[5] >= $res_5) ? $res_5 : $sack[5]).' WHERE `user` = "'.$user['id'].'"');
db_query("UPDATE `users` SET `g` = `g` - ".$kiek_primoketi." WHERE id='".$user['id']."'");
db_query('UPDATE `users` SET `s` = "'.$user['s'].'" WHERE `id` = "'.$user['id'].'"');
header('location: /smith/smith/'.$inv['id'].'/?');
}
if(rand(1,100) < $chanse) {
db_query('UPDATE `inv` SET `smith` = `smith` + 1,
`_str` = "'.($inv['_str'] + $smith).'",
`_vit` = "'.($inv['_vit'] + $smith).'",
`_agi` = "'.($inv['_agi'] + $smith).'",
`_def` = "'.($inv['_def'] + $smith).'" WHERE `id` = "'.$inv['id'].'"');
header('location: /smith/smith/'.$inv['id'].'/');
if($inv['equip'] == 1) {
db_query('UPDATE `users` SET `str` = `str` + "'.($inv['str'] + $smith).'",
`vit` = `vit` + "'.($inv['vit'] + $smith).'",
`agi` = `agi` + "'.($inv['agi'] + $smith).'",
`def` = `def` + "'.($inv['def'] + $smith).'" WHERE `id` = ''.$user['id'].''');
header('location: /smith/smith/'.$inv['id'].'/');
}
if($inv['smith'] > 0) {
$smith += 24;
}
if($inv['smith'] > 1) {
$smith += 28;
}
if($inv['smith'] > 2) {
$smith += 32;
}
if($inv['smith'] > 3) {
$smith += 36;
}
if($inv['smith'] > 4) {
$smith += 40;
}
if($inv['smith'] > 5) {
$smith += 44;
}
if($inv['smith'] > 6) {
$smith += 48;
}
if($inv['smith'] > 7) {
$smith += 52;
}
if($inv['smith'] > 8) {
$smith += 56;
}
if($inv['smith'] > 9) {
$smith += 60;
}
if($inv['smith'] > 10) {
$smith += 64;
}
if($inv['smith'] > 11) {
$smith += 68;
}
if($inv['smith'] > 12) {
$smith += 72;
}
if($inv['smith'] > 13) {
$smith += 76;
}
if($inv['smith'] > 14) {
$smith += 80;
}
if($inv['smith'] > 15) {
$smith += 84;
}
if($inv['smith'] > 16) {
$smith += 88;
}
if($inv['smith'] > 17) {
$smith += 92;
}
if($inv['smith'] > 18) {
$smith += 96;
}
if($inv['smith'] > 19) {
$smith += 100;
}
if($inv['smith'] > 20) {
$smith += 124;
}
$_SESSION['ok'] = '<font color='#90c090'><b>Удача!</b></font>
<div class='separator'></div>
Вещь заточилась<br/>
<font color='#90c090'>+ '.$smith.'</font> к параметрам вещи';
}
else
{
$_SESSION['err'] = '<b>Неудача!</b><br/>';
}
}
else
{
}
?>
<div class='block_zero'>
<table cellpadding='0' cellspacing='0'>
<tr>
<td><img src='/itemImage.php?id=<?=$item['id']?>&smith=<?=$inv['smith']?>' alt='*'/></td>
<td valign='top' style='padding-left: 5px;'><img src='/images/icon/quality/<?=$item['quality']?>.png' alt="*"/> <a href='/item/<?=$inv['id']?>/'><?=$item['name']?></a>
<?php
if($inv['smith'] > 0) {
if($inv['smith'] > 0) {
$smith += 24;
}
if($inv['smith'] > 1) {
$smith += 28;
}
if($inv['smith'] > 2) {
$smith += 32;
}
if($inv['smith'] > 3) {
$smith += 36;
}
if($inv['smith'] > 4) {
$smith += 40;
}
if($inv['smith'] > 5) {
$smith += 44;
}
if($inv['smith'] > 6) {
$smith += 48;
}
if($inv['smith'] > 7) {
$smith += 52;
}
if($inv['smith'] > 8) {
$smith += 56;
}
if($inv['smith'] > 9) {
$smith += 60;
}
if($inv['smith'] > 10) {
$smith += 64;
}
if($inv['smith'] > 11) {
$smith += 68;
}
if($inv['smith'] > 12) {
$smith += 72;
}
if($inv['smith'] > 13) {
$smith += 76;
}
if($inv['smith'] > 14) {
$smith += 80;
}
if($inv['smith'] > 15) {
$smith += 84;
}
if($inv['smith'] > 16) {
$smith += 88;
}
if($inv['smith'] > 17) {
$smith += 92;
}
if($inv['smith'] > 18) {
$smith += 96;
}
if($inv['smith'] > 19) {
$smith += 100;
}
if($inv['smith'] > 20) {
$smith += 124;
}
}
?>
<br/>
<small><font color="<?=$quality_color?>"><?=$quality?> [<?=$inv['bonus']?>/<?=$bonus?>]</font></small>
</td></tr></table>
</div>
<?php
if ($user['s'] >= $s && ($sack[1] < $res_1 or $sack[2] < $res_2 or $sack[3] < $res_3 or $sack[4] < $res_4 or $sack[5] < $res_5)) {
$primoket = 0;
if ($sack[1] < $res_1) {
$primoket += ($res_1 - $sack[1]) * 25;
}
if ($sack[2] < $res_2) {
$primoket += ($res_2 - $sack[2]) * 25;
}
if ($sack[3] < $res_3) {
$primoket += ($res_3 - $sack[3]) * 25;
}
if ($sack[4] < $res_4) {
$primoket += ($res_4 - $sack[4]) * 25;
}
if ($sack[5] < $res_5) {
$primoket += ($res_5 - $sack[5]) * 25;
}
}
?>
<center>Шанс заточить до <font color='#90c090'>+<?=($inv['smith'] + 1)?></font>: <?=$chanse?>%<br/>
<font color='#90c090'>+<?=$smith?></font> к параметрам вещи<br/><br/>
<a href='/smith/smith/<?=$inv['id']?>/<?=($user['s'] >= $s && ($sack[1] < $res_1 or $sack[2] < $res_2 or $sack[3] < $res_3 or $sack[4] < $res_4 or $sack[5] < $res_5)) ? '?start2=true' :'?start=true'?>' class='btn'><span class='end'><span class='label'><?=($user['s'] >= $s && ($sack[1] < $res_1 or $sack[2] < $res_2 or $sack[3] < $res_3 or $sack[4] < $res_4 or $sack[5] < $res_5)) ? '<img src=/images/icon/smith.png> Заточить за <img src=/images/icon/gold.png> '.$primoket.'</a></span></span>' :'<img src=/images/icon/smith.png> Заточить</a></span></span>';
?>
</div><br/>
Для заточки на <font color='#90c090'>+<?=($inv['smith'] + 1)?></font> требуется:<br/>
<img src='/images/icon/res/1.png' alt='*'/> Алмаз, <?=$res_1?> шт. - <?=($sack[1] >= $res_1 ? '<font color='#90c090'>Есть!</font>':'<font color='#f03030'>Не хватает '.($res_1 - $sack[1]).'!</font>')?><br/>
<img src='/images/icon/res/2.png' alt='*'/> Корунд, <?=$res_2?> шт. - <?=($sack[2] >= $res_2 ? '<font color='#90c090'>Есть!</font>':'<font color='#f03030'>Не хватает '.($res_2 - $sack[2]).'!</font>')?><br/>
<img src='/images/icon/res/3.png' alt='*'/> Обсидиан, <?=$res_3?> шт. - <?=($sack[5] >= $res_3 ? '<font color='#90c090'>Есть!</font>':'<font color='#f03030'>Не хватает '.($res_3 - $sack[3]).'!</font>')?><br/>
<img src='/images/icon/res/4.png' alt='*'/> Графит, <?=$res_4?> шт. - <?=($sack[4] >= $res_4 ? '<font color='#90c090'>Есть!</font>':'<font color='#f03030'>Не хватает '.($res_4 - $sack[4]).'!</font>')?><br/>
<img src='/images/icon/res/5.png' alt='*'/> Оникс, <?=$res_5?> шт. - <?=($sack[5] >= $res_5 ? '<font color='#90c090'>Есть!</font>':'<font color='#f03030'>Не хватает '.($res_5 - $sack[5]).'!</font>')?><br/>
<img src='/images/icon/silver.png' alt='*'/> Серебро, <?=$s?> шт. - <?=($user['s'] >= $s ? '<font color='#90c090'>Есть!</font>':'<font color='#f03030'>Не хватает '.($s - $user['s']).'!</font>')?>
</div>
<?php
}
else
{
?>
<div class='mini-line'></div>
<div class='block_zero' align='center'>
<font color='#9bc'>Заточка улучшает все параметры вещи!</font>
</div><div class='mini-line'></div>
<?php
$q = db_query('SELECT * FROM `inv` WHERE `user` = "'.$user['id'].'" AND `smith` < 50');
$items = db_result($q,0);
if($items > 0) {
?>
<div class='block_zero'>
<?php
$q = db_query('SELECT * FROM `inv` WHERE `user` = "'.$user['id'].'" AND `smith` < 50');
while($row = db_fetch_array($q)) {
$item = db_query('SELECT * FROM `items` WHERE `id` = "'.$row['item'].'"');
$item = db_fetch_array($item);
switch($item['quality']) {
case 0:
$bonus = 0;
$quality = 'Простой';
$quality_color = "#986";
break;
case 1:
$bonus = 5;
$quality = 'Обычный';
$quality_color = "#6c3";
break;
case 2:
$bonus = 10;
$quality = 'Редкий';
$quality_color = "#69c";
break;
case 3:
$bonus = 15;
$quality = 'Эпический';
$quality_color = "#c6f";
break;
case 4:
$bonus = 20;
$quality = 'Легенарный';
$quality_color = "#f60";
break;
case 5:
$bonus = 50;
$quality = 'Божественный';
$quality_color = "#999";
break;
case 6:
$bonus = 100;
$quality = 'Сверх Божественный';
$quality_color = "#999";
break;
}
?>
<table cellpadding='0' cellspacing='0'>
<tr>
<td><img src='/itemImage.php?id=<?=$row['item']?>&smith=<?=$row['smith']?>' alt='*'/></td>
<td valign='top' style='padding-left: 5px;'><img src='/images/icon/quality/<?=$item['quality']?>.png' alt='*'/> <a href='/item/<?=$row['id']?>/'><?=$item['name']?></a> <small class='grey'><?=((int)$row['equip']===1?'надето':'в сумке')?></small>
<?php
if($row['smith'] > 0) {
?>
<font color='#9c9'>+<?=$row['smith']?></font>
<?php
}
?>
<br/>
<small><font color="<?=$quality_color?>"><?=$quality?> [<?=$row['bonus']?>/<?=$bonus?>]</font></small>
</td></tr></table><br/>
<div align='center'><a class='btn' href='/smith/smith/<?=$row['id']?>/'><span class='end'> <span class='label'>Выбрать</a></span></span></div>
<?php
}
?>
</div>
<?php
}
else
{
?>
<div class='block_zero' align='center'>
<font color='#999'>Подходящих вещей нет!</font>
</div>
<?php
}
}
echo '</div>';
include './system/f.php';
break;
/**
* by Метриум (Стэлп)
*
* @ Create class Item
*
* @ Date 13.02.2017 15:03
*/
case 'SendRunes':
$title = 'Перенести руну';
include './system/h.php';
$Items = new Item();
$InvSql = db_fetch_array(db_query('SELECT * FROM `inv` WHERE `id` = "'._string($_SESSION['item']).'" AND `user` = "'.$user['id'].'"'));
?>
<div class='title'><?=$title?></div>
<div class='line'></div>
<div class='menu'>
<center/><img src='/images/town/rune.png' alt='*'/>
<center/><font color='#9bc'>Выберете вещь на которую хотите перенести руну!</font>
</div><div class='line'></div>
<div class='content'>
<font color='#90c090'>Выбраная вещь для переноса руны:</font>
</div>
<div class='line'></div>
<div class='menu'>
<?=$Items->ItemWiew($_SESSION['item'])?>
</div>
</div>
<div class='line'></div>
<?php
@$items = db_result(db_query('SELECT * FROM `inv` WHERE `user` = "'.$user['id'].'" AND `equip` = "0" AND `rune` = "0" AND `quality` = "'.$InvSql['quality'].'"'),0);
if($items > 0) {
?>
<div class='main'>
<div class='menuList'>
<font color='#9bc'>Список вещей для переноса руны:</font>
</div>
<div class='line'></div>
<?php
$q = db_query('SELECT * FROM `inv` WHERE `user` = "'.$user['id'].'" AND `equip` = "0" AND `rune` = "0" AND `quality` = "'.$InvSql['quality'].'" ');
while($row = db_fetch_array($q)) {
$item = db_fetch_array(db_query('SELECT * FROM `items` WHERE `id` = "'.$row['item'].'"'));
if(isset($_GET['SendRuneConfirm'])) {
$id = _string(_num($_GET['id'] ?? 0));
$_ItemExit = db_fetch_array(db_query('SELECT * FROM `inv` WHERE `id` = "'.$id.'" AND `user` = "'.$user['id'].'" AND `equip` = "0" AND `rune` = "0" AND `quality` = "'.$InvSql['quality'].'"'));
if(!$_ItemExit) exit(header('location: /'));
?><div class='content'>
</div>
<?=$Items->ItemWiew($id)?>
<div align='center'><a href='/smith/SendRunes/?SendRune&id=<?=$id?>' class='btn'><span class='end'><span class='label'>Перенести руну</a></div>
</div>
<div class='line'></div>
<div class='content'>
<div class='main'>
<div class='menuList'>
* Вещь с которой вы сделаете перенос пропадёт.</div>
</div><div class='line'></div>
<div class='main'>
<div class='menuList'>
<a href='/smith/SendRunes/'<img src='/images/icon/arrow.png' alt='*'/> Вернуться</a>
</div></div>
<?php
include './system/f.php';
exit();
}
if(isset($_GET['SendRune'])) {
$id = _string(_num($_GET['id'] ?? 0));
$_ItemExit = db_fetch_array(db_query('SELECT * FROM `inv` WHERE `id` = "'.$id.'" AND `user` = "'.$user['id'].'" AND `equip` = "0" AND `rune` = "0" AND `quality` = "'.$InvSql['quality'].'"'));
if(!$_ItemExit) exit(header('location: /'));
$Items->SendRune($id,$user['id']);
exit(header('Location: /inv/bag/'));
}
$CloudInvertory = db_fetch_array(db_query('SELECT * FROM `inv` WHERE `id` = "'._string($_SESSION['item']).'"'));
$CloudItem = db_fetch_array(db_query('SELECT * FROM `items` WHERE `id` = "'.$CloudInvertory['item'].'"'));
if($CloudItem['w'] == $item['w']) {
echo $Items->ItemList($row['item'],$row['smith'],$item['quality'],$row['id'], $item['name'],$row['bonus'],$row['rune'],$row['smith']);
?>
<div align="center"><a href="/smith/SendRunes/?SendRuneConfirm&id=<?=$row['id'];?>" class="btn"><span class="end"><span class="label">Перенести</a></div>
</li>
<?php
}
}
?>
</div><div class='line'></div>
<div class='main'>
<div class='menuList'>
* Вещь с которой вы сделаете перенос пропадёт.</a></div>
</div>
<?php
}
else
{
?>
<div class='main'>
<div class='menuList'>
<div class='content' align='center'>
У вас нет подходящих вещей для <img src='/images/icon/rune.png' alt='*'/> переноса рун<br/>
Вещи можно купить в <img src='/images/icon/equip.png' alt='*'/> <a>Магазине</a><br/><br/>
<a href='/shop' class='btn'><span class='end'><span class='label'>Магазин снаряжения</a>
<?php
}
include './system/f.php';
break;
}
?>