Файл: titwar.ru/item.php
Строк: 289
<?
include './system/common.php';
include './system/functions.php';
include './system/user.php';
if(!$user) {
header('location: /');
exit;
}
$id = _string(_num($_GET['id']));
$inv = mysql_query('SELECT * FROM `inv` WHERE `id` = "'.$id.'"');
$inv = mysql_fetch_array($inv);
if(!$inv) {
header('location: /');
exit;
}
$item = mysql_query('SELECT * FROM `items` WHERE `id` = "'.$inv['item'].'"');
$item = mysql_fetch_array($item);
$title = $item['name'];
include './system/h.php';
switch($item['quality']) {
case 0:
$all_bonus = 0;
$quality = 'Common';
$quality_color = "#986";
break;
case 1:
$all_bonus = 5;
$quality = 'Uncommon';
$quality_color = "#6c3";
break;
case 2:
$all_bonus = 10;
$quality = 'Rare';
$quality_color = "#69c";
break;
case 3:
$all_bonus = 15;
$quality = 'Epic';
$quality_color = "#c6f";
break;
case 4:
$all_bonus = 20;
$quality = 'Legendary';
$quality_color = "#f60";
break;
case 5:
$all_bonus = 50;
$quality = 'Divine';
$quality_color = "#999";
break;
case 6:
$all_bonus = 65;
$quality = 'Super Divine';
$quality_color = "#999";
break;
}
switch($item['w']) {
case 1:
$w = 'Head';
break;
case 2:
$w = 'Shoulders';
break;
case 3:
$w = 'Torso';
break;
case 4:
$w = 'Gloves';
break;
case 5:
$w = 'Left hand';
break;
case 6:
$w = 'Right hand';
break;
case 7:
$w = 'Legs';
break;
case 8:
$w = 'Shoes';
break;
}
?>
<div class='line'></div>
<div class='content'>
<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="*"/> <?=$item['name']?>, <?=$w?>
<br/>
<small><small>
<font color='<?=$quality_color?>'><small><?=$quality?> [<?=$inv['bonus']?>/<?=$all_bonus?>]</font><br/>
Skills: <img src='/images/icon/skill.png' alt='*'/>
<?
if($user['skill'] < $item['skill']) {
?>
<font color='#c66'>
<?
}
echo $item['skill'];
if($user['skill'] < $item['skill']) {
?>
</font>
<?
}
?>
</small></small></td>
</tr></table>
</div>
<div class='line'></div>
<div class="content">
<?
$equip_item = mysql_query('SELECT * FROM `inv` WHERE `id` = "'.$user['w_'.$item['w']].'"');
$equip_item = mysql_fetch_array($equip_item);
$diff = 0;
?>
<img src='/images/icon/str.png' alt='*'/> Strength: <font color="
<?
if($inv['_str'] > $equip_item['_str']) {
$diff += $inv['_str'] - $equip_item['_str'];
?>#3c3<?
}
else
{
?>#c66<?
}
?>
"> <?=$inv['_str']?></font><br/>
<img src='/images/icon/vit.png' alt='*'/> Health: <font color="
<?
if($inv['_vit'] > $equip_item['_vit']) {
$diff += $inv['_vit'] - $equip_item['_vit'];
?>#3c3<?
}
else
{
?>#c66<?
}
?>
">
<?=$inv['_vit']?></font><br/>
<img src='/images/icon/agi.png' alt='*'/> Agility: <font color="
<?
if($inv['_agi'] > $equip_item['_agi']) {
$diff += $inv['_agi'] - $equip_item['_agi'];
?>#3c3<?
}
else
{
?>#c66<?
}
?>
"><?=$inv['_agi']?></font><br/>
<img src='/images/icon/def.png' alt='*'/> Protection: <font color="
<?
if($inv['_def'] > $equip_item['_def']) {
$diff += $inv['_def'] - $equip_item['_def'];
?>#3c3<?
}
else
{
?>#c66<?
}
?>"><?=$inv['_def']?></font><br/>
<?
if($user['w_'.$item['w']] != 0) {
if($inv['_str'] > $equip_item['_str'] OR $inv['_vit'] > $equip_item['_vit'] OR $inv['_agi'] > $equip_item['_agi'] OR $inv['_def'] > $equip_item['_def']) {
?>
<img src='/images/icon/quest.png' alt='*'/> <font color='#3c3'>Better +<?=$diff?></font>
<?
}
}
$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;
}
$bonus = 0;
if($inv['bonus'] > 0) {
}
if($inv['rune']) {
switch($inv['rune']) {
case 1:
$rune_stats = 75;
break;
case 2:
$rune_stats = 150;
break;
case 3:
$rune_stats = 250;
break;
case 4:
$rune_stats = 600;
break;
case 5:
$rune_stats = 1000;
break;
}
switch($item['w']) {
case 1:
$rune_stat = 'of strength';
break;
case 2:
$rune_stat = 'of health';
break;
case 3:
$rune_stat = 'of health';
break;
case 4:
$rune_stat = 'of agility';
break;
case 5:
$rune_stat = 'of strength';
break;
case 6:
$rune_stat = 'of strength';
break;
case 7:
$rune_stat = 'of protection';
break;
case 8:
$rune_stat = 'of health';
break;
}
}
$bonus = 0;
switch($item['quality']) {
case 0:
$bonus = $inv['bonus'] * 0;
break;
case 1:
$bonus = $inv['bonus'] * 4.8;
break;
case 2:
$bonus = $inv['bonus'] * 6;
break;
case 3:
$bonus = $inv['bonus'] * 6.8;
break;
case 4:
$bonus = $inv['bonus'] * 8;
break;
case 5:
$bonus = $inv['bonus'] * 16;
break;
case 6:
$bonus = $inv['bonus'] * 16;
break;
}
?>
</div>
<div class='line'></div>
<div class='menu'>
<li><img src='/images/icon/rune.png' alt='*'/> Rune: <?=($inv['rune'] ? '<img src="/images/icon/quality/'.$inv['rune'].'.png" alt="*"/> <font color="#9c9">+'.$rune_stats.'</font> '.$rune_stat:'<font color="#999">отсутствует</font>')?><br/>
<?
if($inv['rune'] == 0 && $inv['user'] == $user['id']) {
?>
<br/><a href='/smith/runes/<?=$inv['id']?>/' class='button'>Buy runes</a>
<?
}
?>
</li>
<li><img src='/images/icon/smith.png' alt='*'/> Sharpened: <font color='#9c9'>+<?=$inv['smith']?></font>
<?
if($inv['smith'] < 20 && $inv['user'] == $user['id']) {
?>
<br/>
<a href='/smith/smith/<?=$inv['id']?>/' class='button'>Sharpen</a>
<?
}
?>
</li>
<li class='no_b'><img src='/images/icon/quality/<?=$item['quality']?>.png' alt='*'/> Bonus: <?=$inv['bonus']?> of <?=$all_bonus?>
<?
if($inv['bonus'] < $all_bonus && $inv['user'] == $user['id']) {
?>
<br/>
<a href='/smith/bonus/<?=$inv['id']?>/' class='button'>Upgrade</a>
<?
}
?>
</li>
</div>
<?
if($inv['user'] == $user['id']) {
if($user['w_'.$item['w']] == $inv['id'] OR !$user['w_'.$item['w']] OR $user['w_'.$item['w']] != $inv['id']) {
?>
<div class='line'></div>
<div class='content' align='center'>
<?
if($user['w_'.$item['w']] == $inv['id']) {
?>
<a href='/inv/move/0/<?=$inv['id']?>/' class='button'>Take off</a>
<?
if($user['chest'] == 1) {
?>
<a href='/inv/move/1/<?=$inv['id']?>/' class='button'>Put in the chest</a>
<?
}
}
if(!$user['w_'.$item['w']]) {
?>
<a href='/inv/wear/<?=$inv['id']?>/' class='button'>Put on</a><br/>
<?
}
if($user['w_'.$item['w']] != $inv['id']) {
switch($item['quality']) {
case 0:
$_s = 0;
$_g = 0;
break;
case 1:
$_s = 100;
$_g = 0;
break;
case 2:
$_s = 250;
$_g = 0;
break;
case 3:
$_s = 500;
$_g = 0;
break;
case 4:
$_s = 1000;
$_g = 0;
break;
case 5:
$_s = 50000;
$_g = 0;
break;
case 6:
$_s = 50000;
$_g = 0;
break;
}
?>
<br/><a href='/inv/<?=($inv['place'] == 0 ? 'bag':'chest')?>/?sell=<?=$inv['id']?>' class='button'>Sell item for <?=($_s ? "<img src='/images/icon/silver.png' alt='*'/> $_s":"<img src='/images/icon/gold.png' alt='*'/> $_g")?></a>
<?
}
?>
</div>
<?
}
}
if($equip_item && $inv['user'] != $user['id'] && $user['w_'.$item['w']]) {
$i_equip_item = mysql_query('SELECT * FROM `items` WHERE `id` = "'.$equip_item['item'].'"');
$i_equip_item = mysql_fetch_array($i_equip_item);
switch($i_equip_item['quality']) {
case 0:
$bonus = 0;
$quality = 'Common';
$quality_color = "#908060";
break;
case 1:
$bonus = 5;
$quality = 'Uncommon';
$quality_color = "#60c030";
break;
case 2:
$bonus = 10;
$quality = 'Rare';
$quality_color = "#6090c0";
break;
case 3:
$bonus = 15;
$quality = 'Epic';
$quality_color = "#c060f0";
break;
case 4:
$bonus = 20;
$quality = 'Legendary';
$quality_color = "#f06000";
break;
case 5:
$bonus = 50;
$quality = 'Divine';
$quality_color = "#909090";
break;
case 6:
$bonus = 65;
$quality = 'Super Divine';
$quality_color = "#909090";
break;
}
switch($i_equip_item['w']) {
case 1:
$w = 'Head';
break;
case 2:
$w = 'Shoulders';
break;
case 3:
$w = 'Torso';
break;
case 4:
$w = 'Gloves';
break;
case 5:
$w = 'Left hand';
break;
case 6:
$w = 'Right hand';
break;
case 7:
$w = 'Legs';
break;
case 8:
$w = 'Shoes';
break;
}
?>
<div class='line'></div>
<div class='title'>You are wearing</div>
<div class='line'></div>
<div class='content'>
<table cellpadding='0' cellspacing='0'>
<tr>
<td><img src='/itemImage.php?id=<?=$equip_item['item']?>' alt='*'/></td>
<td valign='top' style='padding-left: 5px;'><img src='/images/icon/quality/<?=$i_equip_item['quality']?>.png' alt="*"/> <?=$i_equip_item['name']?>, <?=$w?>
<br/>
<small><small>
<font color='<?=$quality_color?>'><?=$quality?> [<?=$equip_item['bonus']?>/<?=$bonus?>]</font><br/>
Skills: <font color='#<?=($i_equip_item['skill'] > $user['skill'] ? 'c06060':'ffffff')?>'><?=$i_equip_item['skill']?></font>
</small></small></td>
</tr></table>
</div><div class='line'></div>
<div class='content'>
<img src='/images/icon/str.png' alt='*'/> Strength: <?=$equip_item['_str']?><br/>
<img src='/images/icon/vit.png' alt='*'/> Health: <?=$equip_item['_vit']?><br/>
<img src='/images/icon/agi.png' alt='*'/> Agility: <?=$equip_item['_agi']?><br/>
<img src='/images/icon/def.png' alt='*'/> Protection:<?=$equip_item['_def']?><br/>
</div>
<?
}
include './system/f.php';
?>