Файл: element_fair_users.php
Строк: 285
<?php
require_once './element_options/element_options.php';
if (!$user) { header('Location: /'); exit; }
require_once './element_function/element_function_item.php';
// quality_item_name($quality)
$water_list = array(0 => array('gold' => 10, 'procent' => 25),
1 => array('gold' => 30, 'procent' => 50),
2 => array('gold' => 60, 'procent' => 100),
3 => array('gold' => 200, 'procent' => 125),
4 => array('gold' => 500, 'procent' => 225),
5 => array('gold' => 2000, 'procent' => 350));
if (isset($_GET['item']) AND $go >= 1 AND $go <= 6) {
$wear_item = users_wear_item($user['lost_id']);
$title = $quality_name[$go - 1].' качество';
require_once './element_include/element_head.php';
require_once './element_include/element_header_user_true.php';
$go = $go - 1;
if ($id) {
$shop_item = mysql_fetch_array(mysql_query("SELECT * FROM `element_equipment` WHERE `lost_quality` = '$go' AND `lost_id` = '$id' LIMIT 1"));
if ($shop_item) {
if (isset($_GET['ok'])) {
$bag = users_shoot_item($user['lost_id']);
if (count($bag) >= 20) $error = 'В вашем рюкзаке нет места';
if ($user['lost_money_gold'] < $water_list[$go]['gold']) $error = $error = '<span class="red">Вам не хватает <img src="/images/icons/gold.png">'.($water_list[$go]['gold'] - $user['lost_money_gold']).' золота</span><br/><a class="button w40 mt5 mb5" href="/payment">Купить золото</a>';
if (!isset($error)) {
$create_item = create_item($user['lost_id'], $bag, $shop_item['lost_quality'], $water_list[$go]['procent'], $water_list[$go]['procent'], $water_list[$go]['procent'], false, false, false, $shop_item['lost_mesto'], false);
if ($create_item) {
$shooop = cache_item($create_item);
$quality = quality_item_name($go);
$statistika_user = 'Время: '.rdate("Y год, d M H:i", time()).'<br/>Покупка '.$quality['image'].' <a href="/item?id='.$create_item.'">'.$shooop['lost_name'].'</a> за <img src="/images/icons/gold.png">'.$water_list[$go]['gold'].' золота';
update_money_exp($user, 0, 0, 0, -$water_list[$go]['gold']);
header('Location: /fair?item&go='.($go + 1).'&result');
exit;
} else echo '<div class="nfl p5 mb5 cntr small mlra">Произошла какая-то ошибка</div>';
} else echo '<div class="nfl p5 mb5 cntr small mlra">'.$error.'</div>';
} else {
$quality = quality_item_name($go);
echo '<div class="nfl p5 mb5 cntr small yellow1 mlra">';
echo 'Вы уверены что хотите купить '.$quality['image'].' '.$shop_item['lost_name'].' за ';
echo '<span class="bold"><img src="/images/icons/gold.png">'.nmb_2($water_list[$go]['gold']).' золота?<br/>';
echo '<a class="button w40 mt5 mb5 mr2" href="/fair?item&go='.($go + 1).'&id='.$id.'&ok">Да</a>';
echo '<a class="button w40 ml2" href="/fair?item&go='.($go + 1).'">Нет</a>';
echo '</div>';
}
}
}
if (isset($_GET['result'])) {
echo '<div class="nfl p5 mb5 cntr small yellow1 mlra">Покупка успешно проведена<br/><a class="button w40 mt5 mb5" href="/bag">Рюкзак</a></div>';
}
echo '<div class="nfl p5 mb5 mt5 small mlra">';
echo '<div class="yellow1 cntr mb5"><a href="/fair?item">В магазин снаряжения</a></div>';
$query = mysql_query("SELECT * FROM `element_equipment` WHERE `lost_quality` = '$go'");
while ($myrrow = mysql_fetch_array($query)) {
$quality = quality_item_name($go);
$shoot = item_generation_params($myrrow['lost_strlen'].':'.$water_list[$go]['procent'], $myrrow['lost_heatpoints'].':'.$water_list[$go]['procent'], $myrrow['lost_protection'].':'.$water_list[$go]['procent'], 0);
if (isset($wear_item[$myrrow['lost_mesto']])) {
$my_item = cache_item($wear_item[$myrrow['lost_mesto']]);
$wear = item_generation_params($my_item['lost_strlen'], $my_item['lost_heatpoints'], $my_item['lost_protection'], $my_item['lost_comparison']);
if ($wear['summa'] > $shoot['summa']) $result = '<span class="red">Хуже: -'.($wear['summa'] - $shoot['summa']).'</span>';
else if ($wear['summa'] < $shoot['summa']) $result = '<span class="lngreen">Лучше: +'.($shoot['summa'] - $wear['summa']).'</span>';
else $result = '';
} else $result = '<span class="lngreen">Лучше: +'.($shoot['summa']).'</span>';
echo '<table>';
echo '<td><img width="50" height="50" src="'.$myrrow['lost_avatar'].'"></td>';
echo '<td class="small" valign="top">';
echo '<span class="ml2 small">'.$quality['image'].' <span class="yellow1">'.$myrrow['lost_name'].'</span></span><br/>';
echo '<span class="ml2 small white">'.$result.'</span><br/>';
echo '<span class="ml2 small white">Цена: <img src="/images/icons/gold.png">'.nmb_2($water_list[$go]['gold']).'</span>';
echo '</td>';
echo '</table>';
echo '<div class="cntr"><a class="button mt5 mb5 w40" href="/fair?item&go='.($go + 1).'&id='.$myrrow['lost_id'].'">Купить</a></div>';
echo '<div class="hr mlra mt5 mb5"></div>';
}
echo '</div>';
require_once './element_include/element_foot_user_true.php';
exit;
}
if (isset($_GET['item'])) {
$title = 'Магазин снаряжения';
require_once './element_include/element_head.php';
require_once './element_include/element_header_user_true.php';
echo '<div class="nfl p5 mb5 mt5 cntr small mlra">';
echo '<div class="yellow1 cntr mb5"><a href="/fair">В магазин</a></div>';
echo '<div class="yellow1 mb5">Выберите качество: </div>';
krsort($quality_name);
foreach ($quality_name as $v_id => $v_name) {
$image = quality_item_name($v_id);
echo $image['image'].' <span class="white">'. $v_name.' качество</span>';
echo '<div class=""><a class="button mt5 mb5 w40" href="/fair?item&go='.($v_id + 1).'">Выбрать</a></div>';
if ($v_id != 0) echo '<div class="hr mlra mt5 mb5 w80"></div>';
}
echo '</div>';
require_once './element_include/element_foot_user_true.php';
exit;
}
if (isset($_GET['blessing'])) {
$timer = ((3600 * 24) * 30);
$title = 'Благословение';
require_once './element_include/element_head.php';
require_once './element_include/element_header_user_true.php';
if ($id AND $id >= 1 AND $id <= 3) {
$blessing = SetBlessing($id);
if (isset($_GET['ok'])) {
if ($user['lost_money_gold'] < $blessing['gold']) $error = 'Вам нехватает <img src="/images/icons/gold.png">'.($blessing['gold'] - $user['lost_money_gold']).' золота<br/><a class="button w50 mt3" href="/payment">Купить золото</a>';
if ($user['lost_blessing'] > 0) $error = 'У Вас уже есть активный премиум';
if (!isset($error)) {
$user['lost_blessing'] = $id;
$user['lost_blessing_time'] = time() + $timer;
$user['lost_add_user_exp'] = $user['lost_add_user_exp'] + $blessing['user_exp'];
$user['lost_add_town_exp'] = $user['lost_add_town_exp'] + $blessing['town_exp'];
$user = SetParams($user, $blessing['params'], $blessing['params'], $blessing['params'], true);
$statistika_user = 'Время: '.rdate("Y год, d M H:i", time()).'<br/>
Покупка "'.$blessing['name'].'" за <img src="/images/icons/gold.png">'.$blessing['gold'].' золота';
update_money_exp($user, 0, 0, 0, -$blessing['gold']);
header('Location: /fair?blessing');
exit;
} else echo '<div class="nfl p5 mt5 mb5 cntr small mlra red">'.$error.'</div>';
} else {
echo '<div class="nfl p5 mb5 mt5 cntr white small mlra">';
echo 'Вы уверены что хотите купить "<span class="yellow1">'.$blessing['name'].'</span>" на 30 дней за <img src="/images/icons/gold.png"><span class="yellow1">'.$blessing['gold'].'</span> золота?<br/>';
echo '<div class="mt5">
<a class="button w40" href="/fair?blessing&id='.$id.'&ok">Да</a>
<a class="button w40" href="/fair?blessing">Нет</a>
</div>';
echo '</div>';
}
}
echo '<div class="nfl p5 mb5 mt5 small mlra">';
echo '<div class="yellow1 cntr mb5"><a href="/fair">В магазин</a></div>';
echo '<div class="game-master cntr">Благословение - является очень полезным бонусом для Вашего персонажа</div>';
echo '<div class="hr mt5 mb5"></div>';
for ($i = 1; $i <= 3; $i++) {
$value = SetBlessing($i);
echo '<table><td><img width="50" height="50" src="/images/'.$value['image'].'"></td><td class="small" valign="top">';
echo '<span class="yellow1 ml2">'.$value['name'].'</span><br/>';
echo '<span class="yellow1 ml2">Цена: <img src="/images/icons/gold.png"><span class="lngreen">'.$value['gold'].'</span> золота</span>';
echo '</td></table>';
echo '<div class="cntr white">';
echo '<div class="yellow1">Преимущества: </div>';
echo '<span class="lngreen">+'.$value['user_exp'].'%</span> к личному опыту<br/>';
echo '<span class="lngreen">+'.$value['town_exp'].'%</span> к городскому опыту<br/>';
echo '<span class="lngreen">+'.$value['nagrada'].'%</span> кристаллов к награде. Не меньше 3<br/>';
echo 'Духи и минотавр: <span class="lngreen">-'.$value['duh'].'%</span> мощности<br/>';
echo '<span class="lngreen">+'.$value['params'].'</span> к вашим параметрам<br/>';
echo '<span class="lngreen">-'.$value['energy'].'</span> сек. на восстановление энергии<br/>';
echo ($user['lost_blessing'] == 0) ? '<a class="button w50 mt5" href="/fair?blessing&id='.$i.'">Купить за <img src="/images/icons/gold.png">'.$value['gold'].'</a>' : '';
if ($user['lost_blessing'] == $i) {
if ($user['lost_blessing_time'] > (time() + (3600 * 24))) {
$time1 = (int)(($user['lost_blessing_time'] - time()) / (3600 * 24));
$time_1 = (int)($time1 * (3600 * 24) + time());
$time2 = $user['lost_blessing_time'] - $time_1;
$time2 = date("$time1 д. Hч. iм. sс.", mktime(0, 0, $time2));
} else {
$time2 = $user['lost_blessing_time'] - time();
$time2 = date("Hч. iм. sс.", mktime(0, 0, $time2));
}
echo '<div class="lngreen mt5">Благословение будет активно ещё: '.$time2.'</div>';
}
echo '</div>';
echo '<div class="hr mt5 mb5"></div>';
}
echo '<div class="yellow1 cntr mt5"><a href="/fair">В магазин</a></div>';
echo '</div>';
require_once './element_include/element_foot_user_true.php';
exit;
}
$title = 'Магазин';
require_once './element_include/element_head.php';
require_once './element_include/element_header_user_true.php';
echo '<div class="nfl p5 mb5 mt5 cntr small mlra">';
echo '<div class="ml5 cntr mr5">
<a class="bl p5 small block odd" href="/fair?item">
<span class="yellow1 bold">Снаряжения</span><br/>
<div class="mt5 white">Вещи любого качества для Вашего персонажа</div>
</a>
</div>';
echo '<div class="ml5 cntr mr5">
<a class="bl p5 small block" href="/fair?blessing">
<span class="yellow1 bold">Благословение</span><br/>
<div class="mt5 white">VIP-аккаунт дает хорошие преимущества Вашему персонажу</div>
</a>
</div>';
//echo '<div><a class="button mt2 mb5 w60" href="/fair?item">Снаряжения</a></div>';
//echo '<div><a class="button mb5 w60" href="/fair?blessing">Благословение</a></div>';
// echo '<div><a class="button w60" href="/fair?blessing">Артефакты</a></div>';
echo '</div>';
require_once './element_include/element_foot_user_true.php';
// echo '<span class="game-master">В магазине Вы можете купить хорошее снаряжение и благословение!</span>';
?>