1. finalize ekrshop

2. shop bying fixes
3. item class code clear
4. moved all gifts to separate file
5. removed artefact upgrade
This commit is contained in:
Igor Barkov [iwork] 2019-01-15 17:56:15 +02:00
parent a393f67ccd
commit 016e5a9ccd
7 changed files with 305 additions and 422 deletions

291
ashop.php
View File

@ -1,15 +1,13 @@
<?php <?php
session_start(); session_start();
if ($_SESSION['uid'] == null) header("Location: index.php"); if ($_SESSION['uid'] == null) header("Location: index.php");
include "config.php"; require_once 'functions.php';
include "functions.php";
if ($user['room'] != 50) { if ($user['room'] != 50) {
header("Location: main.php"); header("Location: main.php");
die(); die();
} }
$itemWeight = db::c()->query('SELECT sum(`massa`) AS `m` FROM `inventory` WHERE `owner` = ?i AND `dressed` = 0 AND `setsale` = 0', $user['id'])->fetch_assoc();
if ($user['battle'] != 0) { if ($user['battle'] != 0) {
header('location: fbattle.php'); header('location: fbattle.php');
die(); die();
@ -17,28 +15,31 @@ if ($user['battle'] != 0) {
$bank = db::c()->query('SELECT `ekr` FROM `bank` WHERE `id`=?i', $_SESSION['uid'])->fetch_assoc(); $bank = db::c()->query('SELECT `ekr` FROM `bank` WHERE `id`=?i', $_SESSION['uid'])->fetch_assoc();
if (isset($_GET['set']) OR isset($_POST['set'])) { $shopItems = db::c()->query('SELECT `ashop`.*,
`magic`.`name` AS `magic_name`,
`magic`.`chanse` AS `magic_chanse`,
`magic`.`time` AS `magic_time`,
`magic`.`file` AS `magic_file`,
`magic`.`targeted` AS `magic_targeted`,
`magic`.`needcharge` AS `magic_needcharge`,
`magic`.`img` AS `magic_img`
$set = empty($_GET['set']) ?: $_GET['set']; FROM `ashop` LEFT JOIN `magic` ON `magic` = `magic`.`id` WHERE `count` > 0 AND `cost` > 0 AND `razdel` = ?i ORDER by `nlevel` ASC, `id` ASC', $_GET['otdel']);
$set = empty($_POST['set']) ?: $_POST['set'];
$count = isset($_POST['count']) && is_numeric($_POST['count']) ? $_POST['count'] : 0; $iteminfo = [];
while ($row = $shopItems->fetch_assoc()) {
$iteminfo[] = new ShopItem($row);
}
if ($count < 1) { if (!empty($_GET['buy'])) {
$count = 0; $dress = db::c()->query('SELECT * FROM `ashop` WHERE `id`=?i', $_GET['buy'])->fetch_assoc();
$count_ok = 0; $itemWeight = db::c()->query('SELECT sum(`massa`) AS `m` FROM `inventory` WHERE `owner` = ?i AND `setsale` = 0', $user['id'])->fetch_assoc();
} else $count_ok = 1; if (($dress['massa'] + $itemWeight['m']) > (get_meshok())) $status = 'Недостаточно места в рюкзаке.';
elseif ($bank['ekr'] >= $dress['ecost'] AND ($dress['count'] > 0 OR $dress['count'] == -1)) {
$dress = db::c()->query('SELECT * FROM `ashop` WHERE `id`=?i', $set)->fetch_assoc(); $goden = '';
if ($count_ok == 0) { if (isset($dress['goden'])) $goden = $dress['goden'] * 24 * 60 * 60 + time(); // Ну вот нахуя?
err('Неправильно введено количество.'); db::c()->query('
} elseif (($dress['massa'] * $_POST['count'] + $itemWeight['m']) > (get_meshok())) {
err('Недостаточно места в рюкзаке.');
} elseif ($count_ok == 1 && ($bank['ekr'] >= ($dress['ecost'] * $_POST['count'])) && ($dress['count'] >= $_POST['count'])) {
for ($k = 1; $k <= $_POST['count']; $k++) {
$goden = '';
if (isset($dress['goden'])) $goden = $dress['goden'] * 24 * 60 * 60 + time(); // Ну вот нахуя?
db::c()->query('
INSERT INTO `inventory` INSERT INTO `inventory`
( (
`prototype`,`owner`,`name`,`type`,`massa`,`cost`,`img`,`maxdur`,`isrep`,`gsila`,`glovk`,`ginta`,`gintel`, `prototype`,`owner`,`name`,`type`,`massa`,`cost`,`img`,`maxdur`,`isrep`,`gsila`,`glovk`,`ginta`,`gintel`,
@ -50,35 +51,26 @@ if (isset($_GET['set']) OR isset($_POST['set'])) {
) )
VALUES (?i,?i,"?s",?i,?i,"?s","?s",?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i) VALUES (?i,?i,"?s",?i,?i,"?s","?s",?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i)
', $dress['id'], $_SESSION['uid'], $dress['name'], $dress['type'], $dress['massa'], $dress['cost'], $dress['img'], $dress['maxdur'], $dress['isrep'], ', $dress['id'], $_SESSION['uid'], $dress['name'], $dress['type'], $dress['massa'], $dress['cost'], $dress['img'], $dress['maxdur'], $dress['isrep'],
$dress['gsila'], $dress['glovk'], $dress['ginta'], $dress['gintel'], $dress['ghp'], $dress['gnoj'], $dress['gtopor'], $dress['gdubina'], $dress['gmech'], $dress['gsila'], $dress['glovk'], $dress['ginta'], $dress['gintel'], $dress['ghp'], $dress['gnoj'], $dress['gtopor'], $dress['gdubina'], $dress['gmech'],
$dress['gfire'], $dress['gwater'], $dress['gair'], $dress['gearth'], $dress['glight'], $dress['ggray'], $dress['gdark'], $dress['needident'], $dress['gfire'], $dress['gwater'], $dress['gair'], $dress['gearth'], $dress['glight'], $dress['ggray'], $dress['gdark'], $dress['needident'],
$dress['nsila'], $dress['nlovk'], $dress['ninta'], $dress['nintel'], $dress['nmudra'], $dress['nvinos'], $dress['nnoj'], $dress['ntopor'], $dress['ndubina'], $dress['nmech'], $dress['nsila'], $dress['nlovk'], $dress['ninta'], $dress['nintel'], $dress['nmudra'], $dress['nvinos'], $dress['nnoj'], $dress['ntopor'], $dress['ndubina'], $dress['nmech'],
$dress['nfire'], $dress['nwater'], $dress['nair'], $dress['nearth'], $dress['nlight'], $dress['ngray'], $dress['ndark'], $dress['mfkrit'], $dress['mfakrit'], $dress['nfire'], $dress['nwater'], $dress['nair'], $dress['nearth'], $dress['nlight'], $dress['ngray'], $dress['ndark'], $dress['mfkrit'], $dress['mfakrit'],
$dress['mfuvorot'], $dress['mfauvorot'], $dress['bron1'], $dress['bron3'], $dress['bron2'], $dress['bron4'], $dress['maxu'], $dress['minu'], $dress['magic'], $dress['mfuvorot'], $dress['mfauvorot'], $dress['bron1'], $dress['bron3'], $dress['bron2'], $dress['bron4'], $dress['maxu'], $dress['minu'], $dress['magic'],
$dress['nlevel'], $dress['nalign'], $goden, $dress['goden'], $dress['razdel'], $dress['artefact'], $dress['koll']); $dress['nlevel'], $dress['nalign'], $goden, $dress['goden'], $dress['razdel'], $dress['artefact'], $dress['koll']);
$inventoryItemId = db::c()->getLastInsertId();
if ($dress['count'] != -1) db::c()->query('UPDATE `ashop` SET `count` = `count`- 1 WHERE `id` = ?i', $_GET['buy']);
$deloText = "{$user['login']} купил товар «{$dress['name']}» id:({$inventoryItemId}) в магазине «Берёзка» за {$dress['ecost']} екр.";
addToDelo($deloText);
$status = "Вы купили «{$dress['name']}» за {$dress['ecost']} екр.";
db::c()->query('UPDATE `bank` SET `ekr` = `ekr` - ?i WHERE `id` = ?i', $dress['ecost'], $_SESSION['uid']);
// Для обновления данных о деньгах на странице
$bank['ekr'] -= $dress['ecost'];
db::c()->query('UPDATE `ashop` SET `count` = `count`- ?i WHERE `id` = ?i', $_POST['count'], $set);
$invdb = db::c()->query('SELECT `id` FROM `inventory` WHERE `name` = "?s" ORDER BY `id` DESC LIMIT ?i', $dress['name'], $_POST['count']);
if ($_POST['count'] == 1) {
$dressinv = $invdb->fetch_assoc();
$dressid = "cap" . $dressinv['id'];
$dresscount = " ";
} else {
$dressid = "";
while ($dressinv = $invdb->fetch_assoc()) {
$dressid .= "cap" . $dressinv['id'] . ",";
}
$dresscount = "(x" . $_POST['count'] . ") ";
}
$allcost = $_POST['count'] * $dress['ecost'];
$deloText = $user['login'] . " купил товар: " . $dress['name'] . $dresscount . "id:(" . $dressid . ") [0/" . $dress['maxdur'] . "] за " . $allcost . " екр.";
db::c()->query('INSERT INTO `delo` (`author` ,`pers`, `text`, `type`, `date`) VALUES (?i, ?i, "?s", ?i, "?s")', 0, $user['id'], $deloText, 1, time());
err('Вы купили ' . $_POST['count'] . ' шт. "' . $dress['name'] . '.');
db::c()->query('UPDATE `bank` SET `ekr` = `ekr` - ?i WHERE `id` = ?i', $allcost, $_SESSION['uid']);
$bank['ekr'] -= $allcost;
}
} else { } else {
err('Недостаточно денег или нет вещей в наличии.'); $status = "Недостаточно денег или нет вещей в наличии.";
} }
} }
$shopCategory = ''; $shopCategory = '';
@ -146,202 +138,67 @@ if ($_REQUEST['compare'] && !$_REQUEST['common'] && !$_REQUEST['present']) {
break; break;
} }
} }
?> ?>
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<link href="css/main.css" rel="stylesheet"/> <link href="css/main.css" rel="stylesheet"/>
<script language="JavaScript"> <script src="js/main.js"></script>
function AddCount(name, txt) {
document.all("hint3").innerHTML = '<form method=post style="margin:0; padding:0;"><table border=0 width=100% cellspacing=1 cellpadding=0 bgcolor="#CCC3AA"><tr><td align=center><B>Купить неск. штук</td><td width=20 align=right valign=top style="cursor: hand" onclick="closehint3();"><b>x</td></tr><tr><td colspan=2>' +
'<table border=0 width=100% cellspacing=0 cellpadding=0 bgcolor="#FFF6DD"><tr><input type="hidden" name="set" value="' + name + '"><td colspan=2 align=center><b><i>' + txt + '</td></tr><tr><td width=80% align=right>' +
'Количество (шт.) <input type="text" name="count" size=4 ></td><td width=20%>&nbsp;<input type="submit" value=" »» ">' +
'</td></tr></table></td></tr></table></form>';
document.all("hint3").style.visibility = "visible";
document.all("hint3").style.left = 100;
document.all("hint3").style.top = 100;
document.all("count").focus();
}
// Закрывает окно
function closehint3() {
document.all("hint3").style.visibility = "hidden";
}
function leave() {
top.frames['main'].location = 'city.php?cp'
}
</script>
</head> </head>
<body> <body>
<h1>Магазин Берёзка</h1> <h1>Магазин Берёзка</h1>
<a href=# onclick=leave()> ← выйти на Центральную площадь</a> <a href=# onclick=leave('city.php?cp')> ← выйти на Центральную площадь</a>
<div><?php if (!empty($status)) err($status); ?></div>
<table border=0 width=100% cellspacing="0" cellpadding="4"> <table border=0 width=100% cellspacing="0" cellpadding="4">
<tr> <tr>
<td valign=top align=left> <td valign=top align=left>
<h3><?= $shopCategory ?></h3>
<!--Магазин--> <!--Магазин-->
<table border=0 width=100% cellspacing="0" cellpadding="0"> <table class="zebra" width=100% cellspacing="1" cellpadding="2">
<tr> <?php foreach ($iteminfo as $ii): ?>
<td> <tr>
<h3><?=$shopCategory?></h3> <td style='width: 150px; text-align: center;'>
</td> <?php $ii->printImage();
</tr> $ii->printControls('ashop'); ?>
<tr> </td>
<td><!--Рюкзак--> <td style='vertical-align: top;'>
<table border=0 width=100% cellspacing="1" cellpadding="2" bgcolor="#A5A5A5"> <?php $ii->printInfo(); ?>
<?php </td>
if ($_REQUEST['present']) { </tr>
if ($_POST['to_login'] && $_POST['flower']) { <?php endforeach; ?>
$to = db::c()->query('SELECT `id`,`login`,`room` FROM `users` WHERE `login` = ?i', $_POST['to_login'])->fetch_assoc();
if ($_POST['to_login'] == $user['login']) {
err('Очень щедро - дарить что-то самому себе! ;)');
} elseif ($to['room'] > 500 && $to['room'] < 561) {
err('Персонаж в данный момент участвует в турнире в Башне Смерти. Попробуйте позже.');
} else {
if ($_POST['from'] == 1) {
$from = 'Аноним';
} elseif ($_POST['from'] == 2 && $user['klan']) {
$from = ' клана ' . $user['klan'];
} else {
$from = $user['login'];
}
db::c()->query('UPDATE `inventory` SET `owner` = ?i, `present` = "?s", `letter` = "?s" WHERE `present` = "?s" AND `id` = "?s" AND `owner` = ?i AND `dressed` = 0 AND `setsale` = 0', $to['id'], $from, $_POST['podarok2'], null, $_POST['flower'], $_SESSION['uid']);
$res = db::c()->query('SELECT `id`,`name`,`duration`,`maxdur` FROM `inventory` WHERE `id` = ?i', $_POST['flower'])->fetch_assoc();
$deloTextSender = "Подарен предмет \"" . $res['name'] . "\" id:(cap" . $res['id'] . ") [" . $res['duration'] . "/" . $res['maxdur'] . "] от \"" . $user['login'] . "\" к \"" . $to['login'] . "\"";
$deloTextReceiver = "Подарен предмет \"" . $res['name'] . "\" id:(cap" . $res['id'] . ") [" . $res['duration'] . "/" . $res['maxdur'] . "] от \"" . $user['login'] . "\" к \"" . $to['login'] . "\"";
db::c()->query('INSERT INTO `delo`(`author`,`pers`,`text`,`type`,`date`) VALUES (0,?i,"?s",1,?i)', $_SESSION['uid'], $deloTextSender, time());
db::c()->query('INSERT INTO `delo`(`author`,`pers`,`text`,`type`,`date`) VALUES (0,?i,"?s",1,?i)', $to['id'], $deloTextReceiver, time());
$telegraphText = "Вам пришёл подарок \"" . $res['name'] . "\" от " . $from . "!";
db::c()->query('INSERT INTO `telegraph` (receiver, text) VALUES (?i,"?s")', $to['id'], $telegraphText)->fetch_assoc();
err('Подарок удачно доставлен к ' . $_POST['to_login']);
}
}
?>
<!-- Подарить подарок -->
<table cellspacing=0 cellpadding=0 width=100% bgcolor=#e0e0e2>
<td>
<form method="post">
<input type=hidden name=present value=1>
Вы можете сделать подарок дорогому человеку. Ваш подарок будет
отображаться в информации о персонаже.
<ol>
<li>Укажите логин персонажа, которому хотите сделать подарок<br>
<input type=text name=to_login value="" placeholder="Логин">
<li><input type=text name=podarok2 value="" maxlength=60 size=50
placeholder="Цель подарка.">
<li><textarea name=txt rows=6 cols=80
placeholder="Текст сопроводительной записки (в информации о персонаже не отображается)"></textarea>
<li>Выберите, от чьего имени подарок:<br>
<label><input type=radio name=from value=0
checked> <?= nick::id($user['id'])->full() ?>
</label><br>
<label><input type=radio name=from value=1> анонимно</label><br>
<label><input type=radio name=from value=2> от имени
клана</label><br>
<li>Нажмите кнопку <b>Подарить</b> под предметом, который хотите
преподнести в подарок:<br>
</ol>
<input type="hidden" name="flower" id="flower" value="">
<table class="zebra" width=100% cellspacing="1" cellpadding="2"
bgcolor="#A5A5A5">
<?php
$data = db::c()->query('SELECT `id`,`img` FROM `inventory` WHERE `owner`= ?i
AND `dressed` = 0
AND (
`name` LIKE "?S" OR `name` LIKE "?S" OR `name` LIKE "?S" OR `name` LIKE "?S" OR `name` LIKE "?S" OR
`name` LIKE "?S" OR `name` LIKE "?S" OR `name` LIKE "?S"
)
AND `setsale` = 0 AND `present` = "?s"
ORDER BY `id` DESC', $_SESSION['uid'], '%Букет%', '%Сувенир%', '%Подарок%', '%Валентинка%', '%Открытка%', 'Ель%', '%Медаль%', '%Статуэтка%', null);
while ($row = $data->fetch_assoc()) {
if (!in_array($row['id'], array_keys($_SESSION['flowers']))) {
$row['count'] = 1;
?>
<tr>
<td align=center style='width:150px'>
<img src="i/sh/<?= $row['img'] ?>">
<br><input type=submit
onClick="document.all['flower'].value="<?= $row['id']; ?>
value="Подарить">
</td>
<td valign=top>
<?php showitem($row); ?>
</td>
</tr>
<?php
}
}
?>
</form>
</td>
</table>
<?
} else {
$data = db::c()->query('SELECT `id`,`img`,`name` FROM `ashop` WHERE `count` > 0 AND `razdel` = "?s" AND `ecost` > 0 ORDER BY `ecost` ASC', $_GET['otdel']);
while ($row = $data->fetch_assoc()) {
?>
<tr>
<td align=center style='width:150px'><img src="i/sh/<?= $row['img'] ?>"
border=0>
<br/>
<a href="ashop.php?otdel=<?= $_GET['otdel'] ?>&set=<?= $row['id'] ?>&sid=">купить</A>
<img src="i/up.gif" width=11 height=11 border=0 alt="Купить несколько штук"
style="cursor:hand"
onClick="AddCount("<?= $row['id'] ?>", "<?= $row['name'] ?>")">
</td>
<td valign=top>
<?php showitem($row); ?>
</td>
</tr>
<?php
}
}
?>
</table>
</td>
</tr>
</table> </table>
</td> </td>
<td valign=top width=280> <td valign=top width=280>
<b>Масса всех ваших вещей: <?= getItemsMassaInfo() ?> <b>Масса всех ваших вещей: <?= getItemsMassaInfo() ?>
<br>У вас в наличии: <span style="color: #339900;"><?= $bank['ekr'] ?></span> екр.</b> <br>У вас в наличии: <span style="color: #339900;"><?= $bank['ekr'] ?></span> екр.</b>
<hr/>
<a href=upgrade_items.php>Улучшение Артефактов</a>
<hr> <hr>
<div style="background-color: #d2d0d0;padding: 1px; text-align: center; font-weight: bold;"> <div style="text-align: center; font-weight: bold;">Отделы магазина</div>
Отделы магазина
</div>
<dl> <dl>
<dt><b>Оружие:</b></dt> <dt><b>Оружие:</b></dt>
<dd><a href="ashop.php?otdel=1&rnd=<?= mt_rand() ?>">кастеты,ножи</a></dd> <dd><a href="?otdel=1&rnd=<?= mt_rand() ?>">кинжалы</a></dd>
<dd><a href="ashop.php?otdel=11&rnd=<?= mt_rand() ?>">топоры</a></dd> <dd><a href="?otdel=11&rnd=<?= mt_rand() ?>">топоры</a></dd>
<dd><a href="ashop.php?otdel=12&rnd=<?= mt_rand() ?>">дубины,булавы</a></dd> <dd><a href="?otdel=12&rnd=<?= mt_rand() ?>">дубины</a></dd>
<dd><a href="ashop.php?otdel=13&rnd=<?= mt_rand() ?>">мечи</a></dd> <dd><a href="?otdel=13&rnd=<?= mt_rand() ?>">мечи</a></dd>
<dt><b>Одежда:</b></dt> <dt><b>Одежда:</b></dt>
<dd><a href="ashop.php?otdel=24&rnd=<?= mt_rand() ?>">шлемы</a></dd> <dd><a href="?otdel=24&rnd=<?= mt_rand() ?>">шлемы</a></dd>
<dd><a href="ashop.php?otdel=23&rnd=<?= mt_rand() ?>">тяжелая броня</a></dd> <dd><a href="?otdel=23&rnd=<?= mt_rand() ?>">тяжелая броня</a></dd>
<dd><a href="ashop.php?otdel=22&rnd=<?= mt_rand() ?>">легкая броня</a></dd> <dd><a href="?otdel=22&rnd=<?= mt_rand() ?>">легкая броня</a></dd>
<dd><a href="ashop.php?otdel=3&rnd=<?= mt_rand() ?>">щиты</a></dd> <dd><a href="?otdel=3&rnd=<?= mt_rand() ?>">щиты</a></dd>
<dd><a href="ashop.php?otdel=21&rnd=<?= mt_rand() ?>">перчатки</a></dd> <dd><a href="?otdel=21&rnd=<?= mt_rand() ?>">перчатки</a></dd>
<dd><a href="ashop.php?otdel=2&rnd=<?= mt_rand() ?>">сапоги</a></dd> <dd><a href="?otdel=2&rnd=<?= mt_rand() ?>">сапоги</a></dd>
<dt><b>Ювелирные товары:</b></dt> <dt><b>Ювелирные товары:</b></dt>
<dd><a href="ashop.php?otdel=4&rnd=<?= mt_rand() ?>">серьги</a></dd> <dd><a href="?otdel=4&rnd=<?= mt_rand() ?>">серьги</a></dd>
<dd><a href="ashop.php?otdel=41&rnd=<?= mt_rand() ?>">ожерелья</a></dd> <dd><a href="?otdel=41&rnd=<?= mt_rand() ?>">ожерелья</a></dd>
<dd><a href="ashop.php?otdel=42&rnd=<?= mt_rand() ?>">кольца</a></dd> <dd><a href="?otdel=42&rnd=<?= mt_rand() ?>">кольца</a></dd>
<dt><b>Магия:</b></dt> <dt><b>Магия:</b></dt>
<dd><a href="ashop.php?otdel=51&rnd=<?= mt_rand() ?>">боевые</a></dd> <dd><a href="?otdel=51&rnd=<?= mt_rand() ?>">боевые</a></dd>
<dd><a href="ashop.php?otdel=5&rnd=<?= mt_rand() ?>">разные</a></dd> <dd><a href="?otdel=5&rnd=<?= mt_rand() ?>">разные</a></dd>
<dt><b>Разное:</b></dt> <dt><b>Разное:</b></dt>
<dd><a href="ashop.php?otdel=6&rnd=<?= mt_rand() ?>">амуниция</a></dd> <dd><a href="?otdel=6&rnd=<?= mt_rand() ?>">амуниция</a></dd>
<dd><a href="ashop.php?otdel=7rnd=<?= mt_rand() ?>">букеты</a></dd> <dd><a href="?otdel=7rnd=<?= mt_rand() ?>">букеты</a></dd>
</dl> </dl>
<div id="hint3" class="ahint"></div>
</td> </td>
</tr> </tr>
</table> </table>

View File

@ -98,64 +98,6 @@ abstract class Item
} }
} }
// ТА ЛААААДНО?!
// $this->name = $row['name'];
// $this->massa = $row['massa'];
// $this->maxdur = $row['maxdur'];
// $this->img = $row['img'];
//
// $this->type = $row['type'];
//
// $this->nlevel = $row['nlevel'];
// $this->nalign = $row['nalign'];
// $this->nsila = $row['nsila'];
// $this->nlovk = $row['nlovk'];
// $this->ninta = $row['ninta'];
// $this->nvinos = $row['nvinos'];
// $this->nintel = $row['nintel'];
// $this->nmudra = $row['nmudra'];
// $this->nnoj = $row['nnoj'];
// $this->ntopor = $row['ntopor'];
// $this->ndubina = $row['ndubina'];
// $this->nmech = $row['nmech'];
// $this->nfire = $row['nfire'];
// $this->nwater = $row['nwater'];
// $this->nair = $row['nair'];
// $this->nearth = $row['nearth'];
// $this->nlight = $row['nlight'];
// $this->ngray = $row['ngray'];
// $this->ndark = $row['ndark'];
//
// $this->minu = $row['minu'];
// $this->maxu = $row['maxu'];
//
// $this->gsila = $row['gsila'];
// $this->glovk = $row['glovk'];
// $this->ginta = $row['ginta'];
// $this->gintel = $row['gintel'];
// $this->gnoj = $row['gnoj'];
// $this->gtopor = $row['gtopor'];
// $this->gdubina = $row['gdubina'];
// $this->gmech = $row['gmech'];
// $this->gfire = $row['gfire'];
// $this->gwater = $row['gwater'];
// $this->gair = $row['gair'];
// $this->gearth = $row['gearth'];
// $this->glight = $row['glight'];
// $this->ggray = $row['ggray'];
// $this->gdark = $row['gdark'];
// $this->ghp = $row['ghp'];
//
// $this->bron1 = $row['bron1'];
// $this->bron2 = $row['bron2'];
// $this->bron3 = $row['bron3'];
// $this->bron4 = $row['bron4'];
//
// $this->mfkrit = $row['mfkrit'];
// $this->mfakrit = $row['mfakrit'];
// $this->mfuvorot = $row['mfuvorot'];
// $this->mfauvorot = $row['mfauvorot'];
switch ($this->type) { switch ($this->type) {
case 1: case 1:
$this->typename = 'Серьги'; $this->typename = 'Серьги';

View File

@ -10,19 +10,46 @@ class ShopItem extends Item
parent::printMagic(); parent::printMagic();
} }
public function buyItem($owner)
{
if ($owner) {
db::c()->query('
INSERT INTO `inventory` (`prototype`,`owner`,`name`,`type`,`massa`,`cost`,`img`,`maxdur`,`isrep`,`gsila`,`glovk`,`ginta`,`gintel`,
`ghp`,`gnoj`,`gtopor`,`gdubina`,`gmech`,`gfire`,`gwater`,`gair`,`gearth`,`glight`,`ggray`,`gdark`,
`needident`,`nsila`,`nlovk`,`ninta`,`nintel`,`nmudra`,`nvinos`,`nnoj`,`ntopor`,`ndubina`,`nmech`,
`nfire`,`nwater`,`nair`,`nearth`,`nlight`,`ngray`,`ndark`,`mfkrit`,`mfakrit`,`mfuvorot`,`mfauvorot`,
`bron1`,`bron2`,`bron3`,`bron4`,`maxu`,`minu`,`magic`,`nlevel`,`nalign`,`dategoden`,`goden`,`otdel`,
`artefact`, `koll`) VALUES (?i,?i,"?s",?i,?i,?i,"?s",?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,
?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,"?s",?i,?i)
', $this->id, $owner, $this->name, $this->type, $this->massa, $this->cost, $this->img, $this->maxdur,$this->isrep,$this->gsila,$this->glovk,$this->ginta,$this->gintel,
$this->ghp,$this->gnoj,$this->gtopor,$this->gdubina,$this->gmech,$this->gfire,$this->gwater,$this->gair,$this->gearth,$this->glight,$this->ggray,$this->gdark,
$this->needident,$this->nsila,$this->nlovk,$this->ninta,$this->nintel,$this->nmudra,$this->nvinos, $this->nnoj,$this->ntopor,$this->ndubina,$this->nmech,
$this->nfire,$this->nwater,$this->nair, $this->nearth,$this->nlight,$this->ngray,$this->ndark,$this->mfkrit,$this->mfakrit,$this->mfuvorot,$this->mfauvorot,
$this->bron1,$this->bron2,$this->bron3,$this->bron4,$this->maxu,$this->minu,$this->magic,$this->nlevel,$this->nalign,$this->dategoden,$this->goden,$this->razdel,
$this->artefact, $this->koll);
}
}
/** /**
* Для кнопок управления под картинкой прелмета в зависимости от ситуации. * Для кнопок управления под картинкой прелмета в зависимости от ситуации.
*/ */
public function printControls($sell = false) public function printControls($shopType = false)
{ {
if ($sell) { switch ($shopType) {
$btnPrice = "Продать"; default:
$btnLink = "/shop.php?sell={$this->id}&rnd=".mt_rand(); $btnPrice = "Купить за " . intval($this->cost) . " кр.";
$this->maxdur = 0; $btnLink = "/shop.php?buy={$this->id}&rnd=" . mt_rand();
} else { break;
$btnPrice = "Купить за " . intval($this->cost) . " кр."; case 'ashop':
$btnLink = "/shop.php?buy={$this->id}&rnd=" . mt_rand(); $btnPrice = "Купить за " . intval($this->ecost) . "р.";
$btnLink = "/ashop.php?buy={$this->id}&rnd=" . mt_rand();
break;
case 'sell':
$btnPrice = "Продать";
$btnLink = "/shop.php?sell={$this->id}&rnd=".mt_rand();
break;
} }
echo <<<BTN echo <<<BTN
<p><input type="button" style="background: darkgrey; border: 1px solid grey; border-radius: 2px;" value="{$btnPrice}" <p><input type="button" style="background: darkgrey; border: 1px solid grey; border-radius: 2px;" value="{$btnPrice}"
onclick="location='{$btnLink}'"> onclick="location='{$btnLink}'">

View File

@ -1612,7 +1612,7 @@ function showitem2()
* По ходу, главная функция отображения предметов. * По ходу, главная функция отображения предметов.
* *
* @param array $row - массив значений, передаваймый из запроса к таблице inventory * @param array $row - массив значений, передаваймый из запроса к таблице inventory
* @param int $type - тип предмета. Где бы их всех взять? * @param int $type - тип предмета. Перечислены в /Classes/Item.php
* @param bool $returned * @param bool $returned
* @param bool $infOnly * @param bool $infOnly
* *
@ -1688,8 +1688,6 @@ function showitem($row, $type = null, $returned = false, $infOnly = false)
$returnHTML .= '<br />ID: ' . $row['id'] . '<br />'; $returnHTML .= '<br />ID: ' . $row['id'] . '<br />';
if ($row["koll"] > 1) $returnHTML .= "<a title=\"Разделить\" onclick=\"splitstack('$row[name]','main.php?edit=1&unstack=$row[id]', '$row[img]', 1);return false;\" href=\"javascript:void(0)\"><img border=\"0\" src=\"i/unstack.gif\"></a>&nbsp;"; if ($row["koll"] > 1) $returnHTML .= "<a title=\"Разделить\" onclick=\"splitstack('$row[name]','main.php?edit=1&unstack=$row[id]', '$row[img]', 1);return false;\" href=\"javascript:void(0)\"><img border=\"0\" src=\"i/unstack.gif\"></a>&nbsp;";
$returnHTML .= "<img src=i/clear.gif style=\"cursor:hand;\" onclick=\"delItmsNo('Выкинуть предмет?','deleteItems',0,'','" . $row['img'] . "','" . $row['name'] . "','main.php?edit=1&destruct=" . $row['id'] . "');\"></TD><td>"; $returnHTML .= "<img src=i/clear.gif style=\"cursor:hand;\" onclick=\"delItmsNo('Выкинуть предмет?','deleteItems',0,'','" . $row['img'] . "','" . $row['name'] . "','main.php?edit=1&destruct=" . $row['id'] . "');\"></TD><td>";
} else {
$returnHTML .= "<a href=upgrade_items.php?up=" . $row['id'] . ">Улучшить</a></td>";
} }
} }

125
presents.php Normal file
View File

@ -0,0 +1,125 @@
<?php
/**
* Created by PhpStorm.
* User: Lopar
* Date: 15.01.2019
* Time: 14:51
*/
/*
* Файл в котором буду аккумулироваться покупка и отправка подарков и сувениров, которые не будут являться предметами,
* а просто записями в базе и просто будут отображаться в инвентаре, как неосязаемая сущность со сроком годности или
* без и правом игрока скрыть или удалить любой подаренный подарок.
*
* На текущем этапе сюда сливаются все подарочные исходные коды из других мест.
*/
session_start();
if ($_SESSION['uid'] != 11263) header("Location: index.php");
require_once 'functions.php';
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<link href="css/main.css" rel="stylesheet"/>
<script src="js/main.js"></script>
</head>
<body>
<h1>Магазин подарков</h1>
<?php
if ($_REQUEST['present']) {
if ($_POST['to_login'] && $_POST['flower']) {
$to = db::c()->query('SELECT `id`,`login`,`room` FROM `users` WHERE `login` = ?i', $_POST['to_login'])->fetch_assoc();
if ($_POST['to_login'] == $user['login']) {
err('Очень щедро - дарить что-то самому себе! ;)');
} elseif ($to['room'] > 500 && $to['room'] < 561) {
err('Персонаж в данный момент участвует в турнире в Башне Смерти. Попробуйте позже.');
} else {
if ($_POST['from'] == 1) {
$from = 'Аноним';
} elseif ($_POST['from'] == 2 && $user['klan']) {
$from = ' клана ' . $user['klan'];
} else {
$from = $user['login'];
}
db::c()->query('UPDATE `inventory` SET `owner` = ?i, `present` = "?s", `letter` = "?s" WHERE `present` = "?s" AND `id` = "?s" AND `owner` = ?i AND `dressed` = 0 AND `setsale` = 0', $to['id'], $from, $_POST['podarok2'], null, $_POST['flower'], $_SESSION['uid']);
$res = db::c()->query('SELECT `id`,`name`,`duration`,`maxdur` FROM `inventory` WHERE `id` = ?i', $_POST['flower'])->fetch_assoc();
$deloTextSender = "Подарен предмет \"" . $res['name'] . "\" id:(cap" . $res['id'] . ") [" . $res['duration'] . "/" . $res['maxdur'] . "] от \"" . $user['login'] . "\" к \"" . $to['login'] . "\"";
$deloTextReceiver = "Подарен предмет \"" . $res['name'] . "\" id:(cap" . $res['id'] . ") [" . $res['duration'] . "/" . $res['maxdur'] . "] от \"" . $user['login'] . "\" к \"" . $to['login'] . "\"";
db::c()->query('INSERT INTO `delo`(`author`,`pers`,`text`,`type`,`date`) VALUES (0,?i,"?s",1,?i)', $_SESSION['uid'], $deloTextSender, time());
db::c()->query('INSERT INTO `delo`(`author`,`pers`,`text`,`type`,`date`) VALUES (0,?i,"?s",1,?i)', $to['id'], $deloTextReceiver, time());
$telegraphText = "Вам пришёл подарок \"" . $res['name'] . "\" от " . $from . "!";
db::c()->query('INSERT INTO `telegraph` (receiver, text) VALUES (?i,"?s")', $to['id'], $telegraphText)->fetch_assoc();
err('Подарок удачно доставлен к ' . $_POST['to_login']);
}
}
}
?>
<!-- Подарить подарок -->
<table cellspacing=0 cellpadding=0 width=100% bgcolor=#e0e0e2>
<td>
<form method="post">
<input type=hidden name=present value=1>
Вы можете сделать подарок дорогому человеку. Ваш подарок будет
отображаться в информации о персонаже.
<ol>
<li>Укажите логин персонажа, которому хотите сделать подарок<br>
<input type=text name=to_login value="" placeholder="Логин">
<li><input type=text name=podarok2 value="" maxlength=60 size=50
placeholder="Цель подарка.">
<li><textarea name=txt rows=6 cols=80
placeholder="Текст сопроводительной записки (в информации о персонаже не отображается)"></textarea>
<li>Выберите, от чьего имени подарок:<br>
<label><input type=radio name=from value=0
checked> <?= nick::id($user['id'])->full() ?>
</label><br>
<label><input type=radio name=from value=1> анонимно</label><br>
<label><input type=radio name=from value=2> от имени
клана</label><br>
<li>Нажмите кнопку <b>Подарить</b> под предметом, который хотите
преподнести в подарок:<br>
</ol>
<input type="hidden" name="flower" id="flower" value="">
<table class="zebra" width=100% cellspacing="1" cellpadding="2"
bgcolor="#A5A5A5">
<?php
$data = db::c()->query('SELECT `id`,`img` FROM `inventory` WHERE `owner`= ?i
AND `dressed` = 0
AND (
`name` LIKE "?S" OR `name` LIKE "?S" OR `name` LIKE "?S" OR `name` LIKE "?S" OR `name` LIKE "?S" OR
`name` LIKE "?S" OR `name` LIKE "?S" OR `name` LIKE "?S"
)
AND `setsale` = 0 AND `present` = "?s"
ORDER BY `id` DESC', $_SESSION['uid'], '%Букет%', '%Сувенир%', '%Подарок%', '%Валентинка%', '%Открытка%', 'Ель%', '%Медаль%', '%Статуэтка%', null);
while ($row = $data->fetch_assoc()) {
if (!in_array($row['id'], array_keys($_SESSION['flowers']))) {
$row['count'] = 1;
?>
<tr>
<td align=center style='width:150px'>
<img src="i/sh/<?= $row['img'] ?>">
<br><input type=submit
onClick="document.all['flower'].value="<?= $row['id']; ?>
value="Подарить">
</td>
<td valign=top>
<?php showitem($row); ?>
</td>
</tr>
<?php
}
}
?>
</form>
</td>
</table>
</body>
</html>

131
shop.php
View File

@ -2,7 +2,7 @@
ob_start(); ob_start();
session_start(); session_start();
if ($_SESSION['uid'] == null) header("Location: index.php"); if ($_SESSION['uid'] == null) header("Location: index.php");
require_once("functions.php"); require_once 'functions.php';
if ($user['room'] != 22) { if ($user['room'] != 22) {
header("Location: main.php"); header("Location: main.php");
@ -101,7 +101,10 @@ FROM `shop` LEFT JOIN `magic` ON `magic` = `magic`.`id` WHERE `count` > 0 AND `c
`magic`.`img` AS `magic_img`, `magic`.`img` AS `magic_img`,
0 AS `maxdur` 0 AS `maxdur`
FROM `inventory` LEFT JOIN `magic` ON `magic` = `magic`.`id` WHERE `dressed` = 0 AND `setsale` = 0 AND `cost` > 0 AND `present` = "?s" AND `tradesale` = 0 AND `podzem` = 0 AND `goden` = 0 AND `owner` = ?i ORDER BY `update` DESC', null, $_SESSION['uid']); FROM `inventory` LEFT JOIN `magic` ON `magic` = `magic`.`id` WHERE
`dressed` = 0 AND `setsale` = 0 AND `cost` > 0 AND `present` = "?s" AND
`tradesale` = 0 AND `podzem` = 0 AND `goden` = 0 AND `artefact` = 0 AND `owner` = ?i
ORDER BY `update` DESC', null, $_SESSION['uid']);
$iteminfo = []; $iteminfo = [];
while ($row = $inventoryItems->fetch_assoc()) { while ($row = $inventoryItems->fetch_assoc()) {
@ -113,14 +116,14 @@ FROM `inventory` LEFT JOIN `magic` ON `magic` = `magic`.`id` WHERE `dressed` = 0
$sellItemId = filter_input(INPUT_GET, 'sell'); $sellItemId = filter_input(INPUT_GET, 'sell');
if ($sellItemId) { if ($sellItemId) {
$dress = db::c()->query('SELECT `id`, `name`, `cost`, `koll` FROM `inventory` WHERE `dressed` = 0 AND `id` = ?i AND `owner` = ?i', $sellItemId, $user['id'])->fetch_assoc(); $dress = db::c()->query('SELECT `id`, `name`, `cost`, `koll` FROM `inventory` WHERE `dressed` = 0 AND `artefact` = 0 AND `id` = ?i AND `owner` = ?i', $sellItemId, $user['id'])->fetch_assoc();
$kols = ''; $kols = '';
if ($dress['koll']) { if ($dress['koll']) {
$dress['cost'] *= $dress['koll']; $dress['cost'] *= $dress['koll'];
$kols = " (x{$dress['koll']}) "; $kols = " (x{$dress['koll']}) ";
} }
$allcost = mt_rand(0,$dress['cost']/2); $allcost = mt_rand(0, $dress['cost'] / 2);
db::c()->query('DELETE FROM `inventory` WHERE `id` = ?i', $dress['id']); db::c()->query('DELETE FROM `inventory` WHERE `id` = ?i', $dress['id']);
db::c()->query('UPDATE `users` SET `money` = `money` + ?i WHERE `id` = ?i', $allcost, $_SESSION['uid']); db::c()->query('UPDATE `users` SET `money` = `money` + ?i WHERE `id` = ?i', $allcost, $_SESSION['uid']);
if ($allcost == 0) $status = "После длительных и изнурительных торгов вы плюнули на всё и просто подарили ваш «{$dress['name']}» торговцу."; if ($allcost == 0) $status = "После длительных и изнурительных торгов вы плюнули на всё и просто подарили ваш «{$dress['name']}» торговцу.";
@ -151,6 +154,7 @@ if (!empty($_GET['buy'])) {
'glovk' => $dress['glovk'], 'glovk' => $dress['glovk'],
'ginta' => $dress['ginta'], 'ginta' => $dress['ginta'],
'gintel' => $dress['gintel'], 'gintel' => $dress['gintel'],
'ghp' => $dress['ghp'], 'ghp' => $dress['ghp'],
'gnoj' => $dress['gnoj'], 'gnoj' => $dress['gnoj'],
'gtopor' => $dress['gtopor'], 'gtopor' => $dress['gtopor'],
@ -163,6 +167,7 @@ if (!empty($_GET['buy'])) {
'glight' => $dress['glight'], 'glight' => $dress['glight'],
'ggray' => $dress['ggray'], 'ggray' => $dress['ggray'],
'gdark' => $dress['gdark'], 'gdark' => $dress['gdark'],
'needident' => $dress['needident'], 'needident' => $dress['needident'],
'nsila' => $dress['nsila'], 'nsila' => $dress['nsila'],
'nlovk' => $dress['nlovk'], 'nlovk' => $dress['nlovk'],
@ -174,6 +179,19 @@ if (!empty($_GET['buy'])) {
'ntopor' => $dress['ntopor'], 'ntopor' => $dress['ntopor'],
'ndubina' => $dress['ndubina'], 'ndubina' => $dress['ndubina'],
'nmech' => $dress['nmech'], 'nmech' => $dress['nmech'],
'nfire' => $dress['nfire'],
'nwater' => $dress['nwater'],
'nair' => $dress['nair'],
'nearth' => $dress['nearth'],
'nlight' => $dress['nlight'],
'ngray' => $dress['ngray'],
'ndark' => $dress['ndark'],
'mfkrit' => $dress['mfkrit'],
'mfakrit' => $dress['mfakrit'],
'mfuvorot' => $dress['mfuvorot'],
'mfauvorot' => $dress['mfauvorot'],
'bron1' => $dress['bron1'], 'bron1' => $dress['bron1'],
'bron2' => $dress['bron2'], 'bron2' => $dress['bron2'],
'bron3' => $dress['bron3'], 'bron3' => $dress['bron3'],
@ -187,10 +205,10 @@ if (!empty($_GET['buy'])) {
'goden' => $dress['goden'], 'goden' => $dress['goden'],
'gmp' => $dress['gmp'], 'gmp' => $dress['gmp'],
'artefact' => $dress['artefact'], 'artefact' => $dress['artefact'],
'koll' => $dress['koll'] 'koll' => $dress['koll'],
]; ];
db::c()->query('INSERT INTO `inventory` SET ?A[?i,?i,"?s",?i,?i,?i,"?s",?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i]', $newItem); db::c()->query('INSERT INTO `inventory` SET ?A[?i,?i,"?s",?i,?i,?i,"?s",?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i]', $newItem);
$inventoryItemId = db::c()->getLastInsertId(); $inventoryItemId = db::c()->getLastInsertId();
if ($dress['count'] != -1) db::c()->query('UPDATE `shop` SET `count` = `count` - 1 WHERE `id` = ?i', $_GET['buy']); if ($dress['count'] != -1) db::c()->query('UPDATE `shop` SET `count` = `count` - 1 WHERE `id` = ?i', $_GET['buy']);
$status = "Вы купили «{$dress['name']}» за {$dress['cost']} кр."; $status = "Вы купили «{$dress['name']}» за {$dress['cost']} кр.";
@ -222,75 +240,66 @@ if (!empty($_GET['buy'])) {
<TABLE width=100% cellspacing="0" cellpadding="4"> <TABLE width=100% cellspacing="0" cellpadding="4">
<TR> <TR>
<TD valign=top align=left> <TD valign=top align=left>
<h3><?= $shopCategoryType ?></h3>
<?php if ($saleItems): ?>
<div style="text-align: center;">Вы можете продать ваши предметы за сущие копейки.</div>
<?php endif; ?>
<!--Магазин--> <!--Магазин-->
<TABLE border=0 width=100% cellspacing="0" cellpadding="0" bgcolor="#A5A5A5"> <TABLE class="zebra" WIDTH=100% CELLSPACING="1" CELLPADDING="2">
<TR> <?php
<TD align=center> if ($saleItems == true) {
<h3><?= $shopCategoryType ?></h3> foreach ($iteminfo as $ii) {
<?php if ($saleItems): ?> echo "<tr><td style='width: 150px; text-align: center;'>";
Вы можете продать ваши предметы за сущие копейки. $ii->printImage();
<?php endif; ?> $ii->printControls('sell');
</TD> echo "</td>";
</TR> echo "<td style='vertical-align: top;'>";
<TR> $ii->printInfo();
<TD> echo "</td></tr>";
<TABLE class="zebra" WIDTH=100% CELLSPACING="1" CELLPADDING="2" BGCOLOR="#A5A5A5"> }
<?php } else {
if ($saleItems == true) { foreach ($iteminfo as $ii) {
foreach ($iteminfo as $ii) { echo "<tr><td style='width: 150px; text-align: center;'>";
echo "<tr><td style='width: 150px; text-align: center;'>"; $ii->printImage();
$ii->printImage(); $ii->printControls();
$ii->printControls(true); echo "</td>";
echo "</td>"; echo "<td style='vertical-align: top;'>";
echo "<td style='vertical-align: top;'>"; $ii->printInfo();
$ii->printInfo(); echo "</td></tr>";
echo "</td></tr>"; }
} }
} else { ?>
foreach ($iteminfo as $ii) {
echo "<tr><td style='width: 150px; text-align: center;'>";
$ii->printImage();
$ii->printControls();
echo "</td>";
echo "<td style='vertical-align: top;'>";
$ii->printInfo();
echo "</td></tr>";
}
}
?>
</TABLE>
</TD>
</TR>
</TABLE> </TABLE>
</TD> </TD>
<TD valign=top width=280> <TD valign=top width=280>
<B>Масса всех ваших вещей: <?= getItemsMassaInfo() ?> <B>Масса всех ваших вещей: <?= getItemsMassaInfo() ?>
<BR>У вас в наличии: <span style="color: darkgreen;"><?= $user['money'] ?></span> кр.</B> <BR>У вас в наличии: <span style="color: darkgreen;"><?= $user['money'] ?></span> кр.</B>
<hr> <hr>
<div style="text-align: center; font-weight: bold;">Отделы магазина</div>
<a href="shop.php?otdel=sale&rnd=<?= mt_rand() ?>">Продать вещи</a> <a href="shop.php?otdel=sale&rnd=<?= mt_rand() ?>">Продать вещи</a>
<dl> <dl>
<dt><b>Оружие:</b></dt> <dt><b>Оружие:</b></dt>
<dd><a href="shop.php?otdel=1&rnd=<?= mt_rand() ?>">кинжалы</a></dd> <dd><a href="?otdel=1&rnd=<?= mt_rand() ?>">кинжалы</a></dd>
<dd><a href="shop.php?otdel=11&rnd=<?= mt_rand() ?>">топоры</a></dd> <dd><a href="?otdel=11&rnd=<?= mt_rand() ?>">топоры</a></dd>
<dd><a href="shop.php?otdel=12&rnd=<?= mt_rand() ?>">дубины</a></dd> <dd><a href="?otdel=12&rnd=<?= mt_rand() ?>">дубины</a></dd>
<dd><a href="shop.php?otdel=13&rnd=<?= mt_rand() ?>">мечи</a></dd> <dd><a href="?otdel=13&rnd=<?= mt_rand() ?>">мечи</a></dd>
<dt><b>Одежда:</b></dt> <dt><b>Одежда:</b></dt>
<dd><a href="shop.php?otdel=24&rnd=<?= mt_rand() ?>">шлемы</a></dd> <dd><a href="?otdel=24&rnd=<?= mt_rand() ?>">шлемы</a></dd>
<dd><a href="shop.php?otdel=23&rnd=<?= mt_rand() ?>">тяжелая броня</a></dd> <dd><a href="?otdel=23&rnd=<?= mt_rand() ?>">тяжелая броня</a></dd>
<dd><a href="shop.php?otdel=22&rnd=<?= mt_rand() ?>">легкая броня</a></dd> <dd><a href="?otdel=22&rnd=<?= mt_rand() ?>">легкая броня</a></dd>
<dd><a href="shop.php?otdel=3&rnd=<?= mt_rand() ?>">щиты</a></dd> <dd><a href="?otdel=3&rnd=<?= mt_rand() ?>">щиты</a></dd>
<dd><a href="shop.php?otdel=21&rnd=<?= mt_rand() ?>">перчатки</a></dd> <dd><a href="?otdel=21&rnd=<?= mt_rand() ?>">перчатки</a></dd>
<dd><a href="shop.php?otdel=2&rnd=<?= mt_rand() ?>">сапоги</a></dd> <dd><a href="?otdel=2&rnd=<?= mt_rand() ?>">сапоги</a></dd>
<dt><b>Ювелирные товары:</b></dt> <dt><b>Ювелирные товары:</b></dt>
<dd><a href="shop.php?otdel=4&rnd=<?= mt_rand() ?>">серьги</a></dd> <dd><a href="?otdel=4&rnd=<?= mt_rand() ?>">серьги</a></dd>
<dd><a href="shop.php?otdel=41&rnd=<?= mt_rand() ?>">ожерелья</a></dd> <dd><a href="?otdel=41&rnd=<?= mt_rand() ?>">ожерелья</a></dd>
<dd><a href="shop.php?otdel=42&rnd=<?= mt_rand() ?>">кольца</a></dd> <dd><a href="?otdel=42&rnd=<?= mt_rand() ?>">кольца</a></dd>
<dt><b>Магия:</b></dt> <dt><b>Магия:</b></dt>
<dd><a href="shop.php?otdel=51&rnd=<?= mt_rand() ?>">боевые</a></dd> <dd><a href="?otdel=51&rnd=<?= mt_rand() ?>">боевые</a></dd>
<dd><a href="shop.php?otdel=5&rnd=<?= mt_rand() ?>">разные</a></dd> <dd><a href="?otdel=5&rnd=<?= mt_rand() ?>">разные</a></dd>
<dt><b>Разное:</b></dt> <dt><b>Разное:</b></dt>
<dd><a href="shop.php?otdel=6&rnd=<?= mt_rand() ?>">амуниция</a></dd> <dd><a href="?otdel=6&rnd=<?= mt_rand() ?>">амуниция</a></dd>
<dd><a href="shop.php?otdel=52&rnd=<?= mt_rand() ?>">руны</a></dd> <dd><a href="?otdel=52&rnd=<?= mt_rand() ?>">руны</a></dd>
</dl> </dl>
<div id="hint3" class="ahint"></div> <div id="hint3" class="ahint"></div>
</TD> </TD>

View File

@ -1,75 +0,0 @@
<?php
session_start();
if ($_SESSION['uid'] == null) header("Location: index.php");
include "config.php";
include "functions.php";
if ($user['room'] != 50) {
header("Location: main.php");
die();
}
if ($user['battle'] != 0) {
header('location: fbattle.php');
die();
}
if (isset($_GET['up'])) {
$ids = $_GET['up'];
$cur = db::c()->query('SELECT `id`,`name`,`nlevel` FROM `inventory` WHERE `owner` = ?i AND `id`= ?i AND `artefact`=1', $user['id'], $ids)->fetch_assoc();
if ($cur['id']) {
$up_level = $cur['nlevel'] + 1;
$cur_up = db::c()->query('SELECT * FROM `ashop_up` WHERE `name` = "?s" AND `level_up` = ?i', $cur['name'], $up_level)->fetch_assoc();
if ($cur_up['id']) {
//mysql_query("UPDATE `inventory` SET `upgrade`='" . $cur_up['level_up'] . "',`nlevel`='" . $cur_up['level_up'] . "',`minu`='" . $cur_up['minu'] . "',`maxu`='" . $cur_up['maxu'] . "',`gsila`='" . $cur_up['gsila'] . "',`glovk`='" . $cur_up['glovk'] . "',`ginta`='" . $cur_up['ginta'] . "',`gintel`='" . $cur_up['gintel'] . "',`ghp`='" . $cur_up['ghp'] . "',`mfkrit`='" . $cur_up['mfkrit'] . "',`mfakrit`='" . $cur_up['mfakrit'] . "',`mfuvorot`='" . $cur_up['mfuvorot'] . "',`mfauvorot`='" . $cur_up['mfauvorot'] . "',`gnoj`='" . $cur_up['gnoj'] . "',`gtopor`='" . $cur_up['gtopor'] . "',`gdubina`='" . $cur_up['gdubina'] . "',`gmech`='" . $cur_up['gmech'] . "',`bron1`='" . $cur_up['bron1'] . "',`bron2`='" . $cur_up['bron2'] . "',`bron3`='" . $cur_up['bron3'] . "',`bron4`='" . $cur_up['bron4'] . "' WHERE `owner`='" . $user['id'] . "' AND `id`='" . $cur['id'] . "'");
err('Услуга недоступна!');
//echo "<font color=green><b>Артефакт успешно улучшен!</b></font>";
} else {
err('Артефакт достиг максимального уровня!');
}
}
}
$itemWeight = db::c()->query('SELECT sum(`massa`) AS `m` FROM `inventory` WHERE `owner` = ?i AND `dressed` = 0 AND `setsale` = 0', $user['id'])->fetch_assoc();
$bank = db::c()->query('SELECT `ekr` FROM `bank` WHERE `id`=?i', $_SESSION['uid'])->fetch_assoc();
$artefactsList = db::c()->query('SELECT * FROM `inventory` WHERE `owner`=?i AND `artefact`=1', $user['id']);
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<link href="css/main.css" rel="stylesheet"/>
</head>
<body>
<h1>Магазин Берёзка</h1>
<div style="text-align: center">Зал улучшения артефактов.</div>
<table border=0 width=100% cellspacing="0" cellpadding="4">
<tr>
<td valign=top align=left>
<table border=0 width=100% cellspacing="1" cellpadding="2" bgcolor="#A5A5A5">
<?php
while ($row = $artefactsList->fetch_assoc()) {
if ($i == 0) {
$i = 1;
$color = '#C7C7C7';
} else {
$i = 0;
$color = '#D5D5D5';
}
showitem($row, 10);
}
?>
</table>
</td>
<td valign=top width=280>
<b>Масса всех ваших вещей: <?= getItemsMassaInfo() ?>
<br>У вас в наличии: <span style="color: #339900;"><?= $bank['ekr'] ?></span> екр.</b>
<hr>
<a href=ashop.php>Магазин Берёзка</a>
<hr>
</td>
</tr>
</table>
</body>
</html>