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) {
header('location: fbattle.php');
die();
}
$bank = db::c()->query('SELECT `ekr` FROM `bank` WHERE `id`=?i', $_SESSION['uid'])->fetch_assoc();
if (isset($_GET['set']) OR isset($_POST['set'])) {
$set = empty($_GET['set']) ?: $_GET['set'];
$set = empty($_POST['set']) ?: $_POST['set'];
$count = isset($_POST['count']) && is_numeric($_POST['count']) ? $_POST['count'] : 0;
if ($count < 1) {
$count = 0;
$count_ok = 0;
} else $count_ok = 1;
$dress = db::c()->query('SELECT * FROM `ashop` WHERE `id`=?i', $set)->fetch_assoc();
if ($count_ok == 0) {
err('Неправильно введено количество.');
} 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`
(
`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,"?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['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['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['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']);
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 {
err('Недостаточно денег или нет вещей в наличии.');
}
}
$shopCategory = '';
if ($_REQUEST['compare'] && !$_REQUEST['common'] && !$_REQUEST['present']) {
$shopCategory = "Составление подарочного букета";
} else {
switch ($_GET['otdel']) {
default:
$shopCategory = "Кастеты и ножи";
$_GET['otdel'] = 1;
break;
case 1:
$shopCategory = "Кастеты и ножи";
break;
case 11:
$shopCategory = "Топоры";
break;
case 12:
$shopCategory = "Дубины и булавы";
break;
case 13:
$shopCategory = "Мечи";
break;
case 14:
$shopCategory = "Луки и арбалеты";
break;
case 2:
$shopCategory = "Сапоги";
break;
case 21:
$shopCategory = "Перчатки";
break;
case 22:
$shopCategory = "Легкая броня";
break;
case 23:
$shopCategory = "Тяжелая броня";
break;
case 24:
$shopCategory = "Шлемы";
break;
case 3:
$shopCategory = "Щиты";
break;
case 4:
$shopCategory = "Серьги";
break;
case 41:
$shopCategory = "Ожерелья";
break;
case 42:
$shopCategory = "Кольца";
break;
case 5:
$shopCategory = "Заклинания: нейтральные";
break;
case 51:
$shopCategory = "Заклинания: боевые и защитные";
break;
case 6:
$shopCategory = "Амуниция";
break;
case 7:
$shopCategory = "Букеты";
break;
}
}
?>
Магазин Берёзка
← выйти на Центральную площадь
=$shopCategory?>
|
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` (owner, text) VALUES (?i,"?s")', $to['id'], $telegraphText)->fetch_assoc();
err('Подарок удачно доставлен к ' . $_POST['to_login']);
}
}
?>
|
Масса всех ваших вещей: = $itemWeight['m'] ?>/= get_meshok() ?>
У вас в наличии: = $bank['ekr'] ?> екр.
Улучшение Артефактов
Отделы магазина
- Оружие:
- кастеты,ножи
- топоры
- дубины,булавы
- мечи
- Одежда:
- шлемы
- тяжелая броня
- легкая броня
- щиты
- перчатки
- сапоги
- Ювелирные товары:
- серьги
- ожерелья
- кольца
- Магия:
- боевые
- разные
- Разное:
- амуниция
- букеты
|
|