Надеюсь рабочая гравировка. ;)
This commit is contained in:
parent
59ded2a9bf
commit
d4244d17d3
80
repair.php
80
repair.php
@ -12,22 +12,26 @@ if ($user['battle'] != 0) {
|
|||||||
die();
|
die();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Гравировка 30 кред.
|
// Гравировка 30 кред. Максимум 32 символа.
|
||||||
if (input::post('set') && input::post('count') && ($user['money'] >= 30)) {
|
if (input::post('gravirovka_text') AND input::post('itemId') AND ($user['money'] >= 30)) {
|
||||||
if (db::c()->query('UPDATE `inventory` SET `text` = "?s" WHERE `dressed` = 0 AND `setsale` = 0 AND `owner` = ?i AND `id` = ?i', input::post('count'), $_SESSION['uid'], input::post('set')))
|
if (33 > iconv_strlen(input::post('gravirovka_text'))) {
|
||||||
|
db::c()->query('UPDATE `inventory` SET `text` = "?s" WHERE `dressed` = 0 AND `setsale` = 0 AND `owner` = ?i AND `id` = ?i', input::post('count'), $_SESSION['uid'], input::post('set'));
|
||||||
db::c()->query('UPDATE `users` SET `money` = `money` - 30 WHERE `id` = ?i', $_SESSION['uid']);
|
db::c()->query('UPDATE `users` SET `money` = `money` - 30 WHERE `id` = ?i', $_SESSION['uid']);
|
||||||
|
$status = 'Гравировка добавлена!';
|
||||||
|
} else $status = 'Превышен лимит в 32 символа!';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Снять гравировку
|
// Снять гравировку.
|
||||||
if ($_GET['rep'] && ($_GET['sid'] == 2)) {
|
if (input::post('gravirovka_remove')) {
|
||||||
mysql_query("UPDATE `inventory` SET `text` = '' WHERE `owner` = '{$user['id']}' AND `dressed` = 0 AND `id` = '" . (int)$_GET['rep'] . "' LIMIT 1");
|
db::c()->query('UPDATE `inventory` SET `text` = ?n WHERE `id` = ?i AND `owner` = ?i', null, input::post('gravirovka_remove'), $_SESSION['uid']);
|
||||||
|
$status = 'Гравировка удалена!';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ремонт 0,5 кред за единицу.
|
// Ремонт 0,5 кред за единицу.
|
||||||
if (input::post('action') == 'repair') {
|
if (input::post('action') == 'repair' AND input::post('itemId')) {
|
||||||
$q = db::c()->query('SELECT `name`, `duration` FROM `inventory` WHERE id = ?i', input::post('itemId'))->fetch_assoc();
|
$q = db::c()->query('SELECT `name`, `duration` FROM `inventory` WHERE id = ?i', input::post('itemId'))->fetch_assoc();
|
||||||
if (ceil($q['duration'] / 2) < $user['money']) {
|
if (ceil($q['duration'] / 2) < $user['money']) {
|
||||||
db::c()->query('UPDATE `inventory` SET `maxdur` = `maxdur` - 1, `duration` = 0 WHERE `id` = ?i AND `owner` = ?i', input::post('itemId'), $_SESSION['uid']);
|
db::c()->query('UPDATE `inventory` SET `maxdur` = `maxdur` - 1, `duration` = 0 WHERE `dressed` = 0 AND `setsale` = 0 AND `id` = ?i AND `owner` = ?i', input::post('itemId'), $_SESSION['uid']);
|
||||||
db::c()->query('UPDATE `users` SET `money` = `money` - ?i WHERE `id` = ?i', ceil($q['duration'] / 2), $_SESSION['uid']);
|
db::c()->query('UPDATE `users` SET `money` = `money` - ?i WHERE `id` = ?i', ceil($q['duration'] / 2), $_SESSION['uid']);
|
||||||
addToDelo('Отремонтирован предмет «' . $q['name'] . '» id:(' . input::post('itemId') . ') за ' . ceil($q['duration'] / 2) . ' кр.');
|
addToDelo('Отремонтирован предмет «' . $q['name'] . '» id:(' . input::post('itemId') . ') за ' . ceil($q['duration'] / 2) . ' кр.');
|
||||||
$status = 'Предмет отремонтирован!';
|
$status = 'Предмет отремонтирован!';
|
||||||
@ -267,11 +271,11 @@ if ($_GET['podgon']) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (input::post('goto') == 'remont') {
|
if (input::post('goto') == 'remont') {
|
||||||
$remont_query = db::c()->query('SELECT `name`,`duration`,`maxdur`,`img`,`id` FROM `inventory` WHERE `type` < 12 AND `dressed` = 0 AND `isrep` = 1 AND `setsale` = 0 AND `duration` > 0 AND `owner` = ?i ORDER BY `update` DESC', $_SESSION['uid']);
|
$remont_query = db::c()->query('SELECT `id`,`name`,`img`,`duration`,`maxdur` FROM `inventory` WHERE `type` < 12 AND `dressed` = 0 AND `isrep` = 1 AND `setsale` = 0 AND `duration` > 0 AND `owner` = ?i ORDER BY `update` DESC', $_SESSION['uid']);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (input::post('goto') == 'gravirovka') {
|
if (input::post('goto') == 'gravirovka') {
|
||||||
$gravirovka_query = db::c()->query('SELECT * FROM `inventory` WHERE `owner` = ?i AND `dressed` = 0 AND `type` = 3 AND `name` NOT LIKE "?S" AND `setsale` = 0 OR `text` <> "?s" AND `owner` = ?i ORDER by `update` DESC', $_SESSION['uid'], '%Букет%', '', $_SESSION['uid']);
|
$gravirovka_query = db::c()->query('SELECT `id`,`name`,`img`,`text` FROM `inventory` WHERE `owner` = ?i AND `dressed` = 0 AND `type` = 3 AND `name` NOT LIKE "?S" AND `setsale` = 0 OR `text` <> "?s" AND `owner` = ?i ORDER by `update` DESC', $_SESSION['uid'], '%Букет%', '', $_SESSION['uid']);
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
@ -284,7 +288,6 @@ if (input::post('goto') == 'gravirovka') {
|
|||||||
<body>
|
<body>
|
||||||
<h1>Ремонтная мастерская</h1>
|
<h1>Ремонтная мастерская</h1>
|
||||||
<a href=# onclick=leave()> ← выйти из мастерской</a><br>
|
<a href=# onclick=leave()> ← выйти из мастерской</a><br>
|
||||||
|
|
||||||
<div class="appblock appblock-main">
|
<div class="appblock appblock-main">
|
||||||
<span class="legend">Информация</span>
|
<span class="legend">Информация</span>
|
||||||
<span class="wrap">Кредиты<span class="num"><?= $user['money'] ?></span></span>
|
<span class="wrap">Кредиты<span class="num"><?= $user['money'] ?></span></span>
|
||||||
@ -296,8 +299,8 @@ if (input::post('goto') == 'gravirovka') {
|
|||||||
<input type="hidden" name="goto" value="remont">
|
<input type="hidden" name="goto" value="remont">
|
||||||
<input type="submit" value="Войти">
|
<input type="submit" value="Войти">
|
||||||
</form>
|
</form>
|
||||||
<span class="wrap">Починка поврежденных предметов. Починка дело непростое: в процессе ремонта состояние предмета
|
<span class="wrap">Починка поврежденных предметов. В процессе ремонта состояние предмета
|
||||||
уменьшится на единицу!</span>
|
уменьшится на единицу!</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="appblock">
|
<div class="appblock">
|
||||||
<span class="legend">Зал гравировки</span>
|
<span class="legend">Зал гравировки</span>
|
||||||
@ -305,7 +308,8 @@ if (input::post('goto') == 'gravirovka') {
|
|||||||
<input type="hidden" name="goto" value="gravirovka">
|
<input type="hidden" name="goto" value="gravirovka">
|
||||||
<input type="submit" value="Войти">
|
<input type="submit" value="Войти">
|
||||||
</form>
|
</form>
|
||||||
<span class="wrap">Нанесение надписей на оружие.</span>
|
<span class="wrap">Нанесение надписей на оружие и удаление надписей из любого обмундирования.
|
||||||
|
Максимум 32 символа!</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="appblock">
|
<div class="appblock">
|
||||||
<span class="legend">Зал зачарований</span>
|
<span class="legend">Зал зачарований</span>
|
||||||
@ -345,7 +349,7 @@ if (input::post('goto') == 'gravirovka') {
|
|||||||
<div class="appblock">
|
<div class="appblock">
|
||||||
<span class="legend"><?= $row['name'] ?></span>
|
<span class="legend"><?= $row['name'] ?></span>
|
||||||
<span class="wrap">Состояние предмета<span class="num"><?= $row['duration'] ?>/<?= $row['maxdur'] ?></span></span>
|
<span class="wrap">Состояние предмета<span class="num"><?= $row['duration'] ?>/<?= $row['maxdur'] ?></span></span>
|
||||||
<span class="wrap">Стоимость ремонта<span class="num"><?= ceil($row['duration'] / 2) ?></span></span>
|
<span class="wrap">Стоимость услуги<span class="num"><?= ceil($row['duration'] / 2) ?></span></span>
|
||||||
<div style="text-align: center">
|
<div style="text-align: center">
|
||||||
<img src="i/sh/<?= $row['img'] ?>">
|
<img src="i/sh/<?= $row['img'] ?>">
|
||||||
<form method="post">
|
<form method="post">
|
||||||
@ -361,14 +365,23 @@ if (input::post('goto') == 'gravirovka') {
|
|||||||
while ($row = $gravirovka_query->fetch_assoc()): ?>
|
while ($row = $gravirovka_query->fetch_assoc()): ?>
|
||||||
<div class="appblock">
|
<div class="appblock">
|
||||||
<span class="legend"><?= $row['name'] ?></span>
|
<span class="legend"><?= $row['name'] ?></span>
|
||||||
|
<span class="wrap">Стоимость услуги<span class="num">30</span></span>
|
||||||
<div style="text-align: center">
|
<div style="text-align: center">
|
||||||
[<?= $row['text'] ?>]
|
<?php if (empty($row['text'])): ?>
|
||||||
<br><img src="i/sh/<?= $row['img'] ?>">
|
<form method="post" id="gravirovka">
|
||||||
<br><? if (empty($row['text'])) { ?><A HREF="#"
|
<input maxlength="32" placeholder="Текст гравировки" name="gravirovka_text">
|
||||||
onclick="AddCount(<?= $row['id'] ?>)">
|
<img src="i/sh/<?= $row['img'] ?>"><br>
|
||||||
Нанести надпись за 30 кр.</A><BR><? } else {
|
<input type="hidden" name="itemId" value="<?= $row['id'] ?>">
|
||||||
?><A HREF="?razdel=1&rep=<?= $row['id'] ?>&sid=2">Стереть надпись</A><BR><?
|
<input type="submit" value="Добавить надпись">
|
||||||
} ?>
|
</form>
|
||||||
|
<?php else: ?>
|
||||||
|
<form method="post" id="gravirovka">
|
||||||
|
<input value="<?= $row['text'] ?>" readonly title>
|
||||||
|
<img src="i/sh/<?= $row['img'] ?>"><br>
|
||||||
|
<input type="hidden" name="gravirovka_remove" value="<?= $row['id'] ?>">
|
||||||
|
<input type="submit" value="Удалить надпись">
|
||||||
|
</form>
|
||||||
|
<?php endif; ?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<?php endwhile; endif; ?>
|
<?php endwhile; endif; ?>
|
||||||
@ -480,29 +493,10 @@ if (input::post('goto') == 'gravirovka') {
|
|||||||
</TR>
|
</TR>
|
||||||
</TABLE>
|
</TABLE>
|
||||||
|
|
||||||
<div id="hint3" class="ahint"></div>
|
<script>
|
||||||
</form>
|
|
||||||
<br>
|
|
||||||
|
|
||||||
<SCRIPT LANGUAGE="JavaScript">
|
|
||||||
function AddCount(name) {
|
|
||||||
document.all("hint3").innerHTML = ' <FORM METHOD=POST ACTION="repair.php?razdel=1"><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();"><BIG><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><small>Какую надпись желаете выгравировать:</small></td></tr><tr><td width=80% align=right>' +
|
|
||||||
'<INPUT TYPE="text" NAME="count" size=30></td><td width=20%> <INPUT TYPE="submit" value=" »» ">' +
|
|
||||||
'</TD></TR></TABLE></td></tr></table>';
|
|
||||||
document.all("hint3").style.visibility = "visible";
|
|
||||||
document.all("hint3").style.left = event.x + document.body.scrollLeft - 20;
|
|
||||||
document.all("hint3").style.top = event.y + document.body.scrollTop + 5;
|
|
||||||
document.all("count").focus();
|
|
||||||
}
|
|
||||||
|
|
||||||
function closehint3() {
|
|
||||||
document.all("hint3").style.visibility = "hidden";
|
|
||||||
}
|
|
||||||
|
|
||||||
function leave() {
|
function leave() {
|
||||||
top.frames['main'].location = 'city.php?cp'
|
top.frames['main'].location = 'city.php?cp'
|
||||||
}
|
}
|
||||||
</SCRIPT>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
Loading…
Reference in New Issue
Block a user