Вход Регистрация
Файл: 3/smith.php
Строк: 174
<?php 
require_once ('system/func.php');
auth(); // Закроем от гостей


switch($_GET['action']) {
  default:
  
$title 'Кузница';
require_once (
'system/header.php');
 echo
'<div class="lent mlra w80">
<div class="bl-ttl"><div class="te"><div class="ttl">
        Кузница
        </div></div></div>'
;
echo
"
<div class='block'>
  <center><img src='/images/other/smith.png' alt='*'/></br>
  <font color='#9bc'>В кузнице можно улучшить свое снаряжение</font></center>
</div>
<a class='btn-blue' href='/smith/smith/'>"
.ico('icons','smitch.png')." Заточка вещей </a>
<a class='btn-blue' href='/jeweler/'>"
.ico('icons','crystal.png')." Ювелир </a>
<a class='btn-blue' href='/jeweler?ametist'>"
.ico('icons','ametist.png')." Обменять аметист</a>
<a class='btn-blue' href='/jeweler?kam'>"
.ico('icons','kam.png')." Камни</a>
<a href='/jeweler?molot' class='btn-blue'>"
.ico('icons','arrow.png')." Купить молот за 100 ".ico('icons','gold.png')." золота</a>
</div></div>"
;
require_once (
'system/footer.php');

  break;
  case 
'smith':
  
$title 'Кузница';
require_once (
'system/header.php');
 echo
'<div class="lent mlra w80">
<div class="bl-ttl"><div class="te"><div class="ttl">
        Кузница
        </div></div></div>'
;

$id num($_GET['id']);

if(
$id) {

  
$inv $db->query('SELECT * FROM `inv` WHERE `id_user` = "'.$user['id'].'" AND `id` = "'.$id.'" AND `odeta` = "net" AND `tip`!="krila" AND `smitch` < 20');
  
$inv $inv->fetch_assoc();
 
  if(!
$inv) {

    
header('location: /smith/smith/');
    
  exit;

  }

switch(
$inv['skill']){
case 
'0':
$quality 'Простое';
$quality_color "#986";
break;
case 
'1':
$quality 'Обычное';
$quality_color "#6c3";
break;
case 
10:
$quality 'Редкое';
$quality_color "#69c";
break;
case 
26:
$quality 'Эпическое';
$quality_color "#c6f";
break;
case 
48:
$quality 'Легендарное';
$quality_color "#f60";
break;
case 
100:
$quality 'Божественное';
$quality_color "#999";
break;
}
  switch(
$inv['smitch']) {
    case 
0:
    
$chanse 90;
     
$smith 24;

     break;
    case 
1:
    
$chanse 85;
     
$smith 28;

     break;
    case 
2:
    
$chanse 80;
     
$smith 32;

     break;
    case 
3:
    
$chanse 75;
     
$smith 36;
     break;
    case 
4:
    
$chanse 70;
     
$smith 40;
     break;
    case 
5:
    
$chanse 65;
     
$smith 44;
     break;
    case 
6:
    
$chanse 60;
     
$smith 48;
     break;
    case 
7:
    
$chanse 55;
     
$smith 52;
     break;
    case 
8:
    
$chanse 50;
     
$smith 56;
     break;
    case 
9:
    
$chanse 45;
     
$smith 60;
     break;
    case 
10:
    
$chanse 40;
     
$smith 64;
     break;
    case 
11:
    
$chanse 35;
     
$smith 68;
     break;
    case 
12:
    
$chanse 30;
     
$smith 72;
     break;
    case 
13:
    
$chanse 25;
     
$smith 76;
     break;
    case 
14:
    
$chanse 20;
     
$smith 80;
     break;
    case 
15:
    
$chanse 20;
     
$smith 84;
     break;
    case 
16:
    
$chanse 20;
     
$smith 88;
     break;
    case 
17:
    
$chanse 20;
     
$smith 92;
     break;
    case 
18:
    
$chanse 20;
     
$smith 96;
     break;
    case 
19:
    
$chanse 20;
     
$smith =100;
     break;
  }
    
$res_1 $inv['smitch'];
    
$res_2 + ($inv['smitch'] * 2);
    
$res_3 + ($inv['smitch'] * 2);
    
$res_4 + ($inv['smitch'] * 2);
    
$res_5 + ($inv['smitch'] * 2);
    
$s 1000 + ($inv['smitch'] * 1000);
    
$sack $db->query('SELECT * FROM `sack` WHERE `user` = "'.$user['id'].'"');      
    
$sack $sack->fetch_assoc();
  if(
$_GET['start'] == true) {
  
$smith_gold false;
    if(
$user['silver'] >= $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)) {
    
$smith_gold true;
    
    }
                    
$kiek_primoketi 0;
                
                if (
$sack[1] < $res_1) {
                
                    
$kiek_primoketi += ($res_1 $sack[1]) * 9;
                
                }
                
                if (
$sack[2] < $res_2) {
                
                    
$kiek_primoketi += ($res_2 $sack[2]) * 9;
                
                }
                
                if (
$sack[3] < $res_3) {
                
                    
$kiek_primoketi += ($res_3 $sack[3]) * 9;
                
                }
                
                if (
$sack[4] < $res_4) {
                
                    
$kiek_primoketi += ($res_4 $sack[4]) * 9;
                
                }
                
                if (
$sack[5] < $res_5) {
                
                    
$kiek_primoketi += ($res_5 $sack[5]) * 9;
                
                }
                if (
$user['silver'] >= $s && (($sack[1] >= $res_1 && $sack[2] >= $res_2 && $sack[3] >= $res_3 && $sack[4] >= $res_4 && $sack[5] >= $res_5) or ($smith_gold == true && $user['gold'] >= $kiek_primoketi))) {

  
                
$user['silver'] = $user['silver'] - $s;
                    
                    
$db->query('UPDATE `users` SET `silver` = "'.$user['silver'].'" WHERE `id` = "'.$user['id'].'"');
                    
                    if (
$smith_gold == 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 `gold`=`gold`-".$kiek_primoketi." WHERE id='".$user['id']."'");
                    
                    }
                    else
                    {
                    
                        
$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'].'"');
                    
                    }
                    
    


echo
"<div class='block2'>";



  if(
rand(5,100) < $chanse) {

$db->query('UPDATE `inv` SET `smitch` = `smitch` + 1,
                               `str` = "'
.($inv['str'] + $smith).'",
                               `health` = "'
.($inv['health'] + $smith).'",
                               `def` = "'
.($inv['def'] + $smith).'" WHERE `id` = "'.$inv['id'].'"');


echo
"
  <font color='#90c090'><b>Удача!</b></font>
 <br>
  Вещь заточилась<br/>
  <font color='#90c090'>+
$smith</font> к параметрам вещи"
  }
  else
  {
echo
"<font color='#c06060'><b>Неудача!</b></font><br/>"
  }
                  }
                else
                {
                
                    echo 
"<div class='block2'>
                    <font color="
red">Недостаточно ресурсов!</font></div>
                    "
;
                
                }
//echo"</div>";
  
}


echo
"<div class='block'>
<table cellpadding='0' cellspacing='0'>
<tr>
  <td><div class='oh'><img src='/images/items/
$inv[tip]/$inv[item].png' style='margin-right:3px;margin-top:-2px;'></div></td>
  <td valign='top' style='padding-left: 5px;'>
  <a href='/item/
$inv[id]/'>$inv[name]</a>";

  if(
$inv['smitch'] > 0) {  
echo
"<font color='#9c9'>+$inv[smitch]</font>";

  }

echo
"
  
  <br/>
  <small><font color=
$quality_color>$quality</font></small>
  </td></tr></table>
  </div>

  <div class='block'>
  
  <div align='center'>Шанс заточить до <font color='#90c090'>+"
.($inv[smitch] + 1)."</font>: $chanse%<br/>
  <font color='#90c090'>+
$smith</font> к параметрам вещи<br/><br/>
  <a href='/smith/smith/
$inv[id]/?start=true' class='btn'><img src='/images/icons/smitch.png' alt='*'/> Заточить</a>";
              if (
$user['silver'] >= $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]) * 9;
                
                }
                
                if (
$sack[2] < $res_2) {
                
                    
$primoket += ($res_2 $sack[2]) * 9;
                
                }
                
                if (
$sack[3] < $res_3) {
                
                    
$primoket += ($res_3 $sack[3]) * 9;
                
                }
                
                if (
$sack[4] < $res_4) {
                
                    
$primoket += ($res_4 $sack[4]) * 9;            
                }            
                if (
$sack[5] < $res_5) {            
                    
$primoket += ($res_5 $sack[5]) * 9;            
                }            
                echo 
"<br>Доплата: ".ico('icons','gold.png').$primoket";        
            }
  echo
"</div></div>
<div class='block2'>
 Для заточки на <font color='#90c090'>+"
.($inv[smitch] + 1)."</font> требуется:<br/>
 <img src='/images/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/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/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/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/res/5.png' alt='*'/>  Оникс,    $res_5 шт. - ".($sack[5] >= $res_5 ? '<font color='#90c090'>Есть!</font>':'<font color='#f03030'>Не хватает '.($res_5 - $sack[5]).'!</font>')."<br/>
 
".ico('icons','silver.png')." Серебро,  $s     шт. - ".($user[silver] >= $s ? '<font color='#90c090'>Есть!</font>':'<font color='#f03030'>Не хватает '.($s - $user['silver']).'!</font>')." 
  
</div></div>";
}
else
{
echo"
<div class='block2' align='center'>
<
font color='#9bc'>Заточка улучшает все параметры вещи!</font>
</
div>";
$item = $db->query("SELECT FROM `invWHERE `id_user` = '$myID' and `odeta` = 'net' AND `smitch` < 20 AND `tip`!='krila'")->fetch_assoc();
# Ошибки #
if(!
$item){
$_SESSION['msg'] = 'Такой вещи не существует, вещь должна быть в сумке';
header('Location: /smith/');
exit();
}
$q = $db->query('SELECT * FROM `inv` WHERE `id_user` = "'.$user['id'].'" AND `odeta` = "net" AND `smitch` < 20 AND `tip`!="krila"');
  while(
$row = $q->fetch_assoc()) {
echo"
<div class='block'>";
  switch(
$row['skill']){
case '0':
$quality = 'Простое';
$quality_color = "#986";
break;
case 
'1':
$quality 'Обычное';
$quality_color "#6c3";
break;
case 
10:
$quality 'Редкое';
$quality_color "#69c";
break;
case 
26:
$quality 'Эпическое';
$quality_color "#c6f";
break;
case 
48:
$quality 'Легендарное';
$quality_color "#f60";
break;
case 
100:
$quality 'Божественное';
$quality_color "#999";
break;
}
echo
"
<table cellpadding='0' cellspacing='0'>
<tr>
  <td><div class='oh'>
  <img src='/images/items/
$row[tip]/$row[item].png' style='margin-right:3px;margin-top:-2px;'></div></td>
  <td valign='top' style='padding-left: 5px;'> <a href='/item/
$row[id]/'>$item[name]</a>
"
;
  if(
$row['smitch'] > 0) {
echo
"<font color='#9c9'>+$row[smitch]</font>";
  }
echo
"
<br/>
<small><font color=
$quality_color>$quality</font></small>
  </td></tr></table>
  
  <div align='center'><a href='/smith/smith/
$row[id]/' class='btn'>Выбрать</a></div></div>";
  }
echo
'</div>';
}
require_once (
'system/footer.php');
  break;
}
?>
Онлайн: 1
Реклама