2018-01-28 16:40:49 +00:00
< ? php
session_start ();
2018-12-12 11:59:29 +00:00
if ( $_SESSION [ 'uid' ] == null ) header ( " Location: index.php " );
2018-12-11 23:00:19 +00:00
require_once ( " functions.php " );
2018-12-11 23:20:11 +00:00
$d = db :: c () -> query ( 'SELECT SUM(`massa`) FROM `inventory` WHERE `dressed` = 0 AND `owner` = ?i' , $_SESSION [ 'uid' ]) -> fetch_assoc ();
if ( $user [ 'room' ] != 23 ) {
header ( " Location: main.php " );
die ();
}
if ( $user [ 'battle' ] != 0 ) {
header ( 'location: fbattle.php' );
die ();
}
2018-01-28 16:40:49 +00:00
2018-12-12 17:16:36 +00:00
// Гравировка 30 кред. Максимум 32 символа.
2018-12-12 18:35:32 +00:00
if ( input :: post ( 'gravirovka_text' ) AND input :: post ( 'itemId' )) {
if ( 30 <= $user [ 'money' ]) {
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 ( 'gravirovka_text' ), $_SESSION [ 'uid' ], input :: post ( 'itemId' ));
db :: c () -> query ( 'UPDATE `users` SET `money` = `money` - 30 WHERE `id` = ?i' , $_SESSION [ 'uid' ]);
$status = 'Гравировка добавлена!' ;
} else $status = 'Превышен лимит в 32 символа!' ;
} else $status = 'Недостаточно денег!' ;
2018-01-28 16:40:49 +00:00
}
2018-12-12 17:16:36 +00:00
// Снять гравировку.
if ( input :: post ( 'gravirovka_remove' )) {
2018-12-12 18:35:32 +00:00
if ( 30 <= $user [ 'money' ]) {
db :: c () -> query ( 'UPDATE `inventory` SET `text` = ?n WHERE `dressed` = 0 AND `setsale` = 0 AND `id` = ?i AND `owner` = ?i' , null , input :: post ( 'gravirovka_remove' ), $_SESSION [ 'uid' ]);
db :: c () -> query ( 'UPDATE `users` SET `money` = `money` - 30 WHERE `id` = ?i' , $_SESSION [ 'uid' ]);
$status = 'Гравировка удалена!' ;
} else $status = 'Недостаточно денег!' ;
2018-01-28 16:40:49 +00:00
}
2018-12-12 16:09:39 +00:00
// Ремонт 0,5 кред за единицу.
2018-12-12 17:16:36 +00:00
if ( input :: post ( 'action' ) == 'repair' AND input :: post ( 'itemId' )) {
2018-12-12 16:09:39 +00:00
$q = db :: c () -> query ( 'SELECT `name`, `duration` FROM `inventory` WHERE id = ?i' , input :: post ( 'itemId' )) -> fetch_assoc ();
if ( ceil ( $q [ 'duration' ] / 2 ) < $user [ 'money' ]) {
2018-12-12 17:16:36 +00:00
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' ]);
2018-12-12 16:09:39 +00:00
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 ) . ' кр.' );
$status = 'Предмет отремонтирован!' ;
} else $status = 'Недостаточно денег!' ;
2018-12-11 23:20:11 +00:00
}
2018-12-12 13:44:14 +00:00
2018-12-12 14:37:00 +00:00
if ( input :: post ( 'goto' ) == 'remont' ) {
2018-12-12 17:16:36 +00:00
$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' ]);
2018-12-12 14:58:41 +00:00
}
2018-12-12 14:48:43 +00:00
2018-12-12 14:58:41 +00:00
if ( input :: post ( 'goto' ) == 'gravirovka' ) {
2018-12-12 18:30:21 +00:00
$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 AND `dressed` = 0 AND `setsale` = 0 ORDER by `update` DESC' , $_SESSION [ 'uid' ], '%Букет%' , '' , $_SESSION [ 'uid' ]);
2018-12-12 14:37:00 +00:00
}
2018-01-28 16:40:49 +00:00
?>
< HTML >
< HEAD >
2018-12-11 23:20:11 +00:00
< meta charset = " utf-8 " >
2018-12-12 11:59:29 +00:00
< link rel = stylesheet href = " css/main.css " >
< link href = " css/secondary.css " rel = " stylesheet " />
2019-01-15 19:34:35 +00:00
< script src = " js/main.js " ></ script >
2018-01-28 16:40:49 +00:00
</ HEAD >
2018-12-11 23:20:11 +00:00
< body >
< h1 > Ремонтная мастерская </ h1 >
2019-01-15 19:34:35 +00:00
< a href = # onclick=hrefToFrame('city.php?cp')> ← выйти из мастерской</a><br>
2018-12-12 14:18:11 +00:00
< div class = " appblock appblock-main " >
< span class = " legend " > Информация </ span >
< span class = " wrap " > Кредиты < span class = " num " >< ? = $user [ 'money' ] ?> </span></span>
< span class = " wrap " > М а с с а вещей < span class = " num " >< ? = getItemsMassaInfo () ?> </span></span>
</ div >
< div class = " appblock " >
< span class = " legend " > Зал ремонта </ span >
< form method = " post " >
< input type = " hidden " name = " goto " value = " remont " >
< input type = " submit " value = " Войти " >
</ form >
2018-12-12 17:16:36 +00:00
< span class = " wrap " > Починка поврежденных предметов . В процессе ремонта состояние предмета
уменьшится на единицу !</ span >
2018-12-12 14:18:11 +00:00
</ div >
< div class = " appblock " >
< span class = " legend " > Зал гравировки </ span >
< form method = " post " >
< input type = " hidden " name = " goto " value = " gravirovka " >
< input type = " submit " value = " Войти " >
</ form >
2018-12-12 17:16:36 +00:00
< span class = " wrap " > Нанесение надписей на оружие и удаление надписей из любого обмундирования .
Максимум 32 символа !</ span >
2018-12-12 14:18:11 +00:00
</ div >
2018-12-12 18:59:19 +00:00
<!--< div class = " appblock " >-->
<!-- < span class = " legend " > Зал зачарований </ span >-->
<!-- < form method = " post " >-->
<!-- < input type = " hidden " name = " goto " value = " magic " >-->
<!-- < input type = " submit " value = " Войти " >-->
<!-- </ form >-->
<!-- < span class = " wrap " > Перезарядка встроеной магии . Если в предмет встроена магия , мы поможем е е перезарядить -->
<!-- за умеренную плату . Учтите , ничто не вечно под луной , в том числе и магия , рано или поздно встроенный -->
<!-- свиток исчерпает все свои ресурсы , и мы уже не сможем е г о перезарядить .</ span >-->
<!--</ div >-->
<!--< div class = " appblock " >-->
<!-- < span class = " legend " > Зал модификаций </ span >-->
<!-- < form method = " post " >-->
<!-- < input type = " hidden " name = " goto " value = " modding " >-->
<!-- < input type = " submit " value = " Войти " >-->
<!-- </ form >-->
<!-- < span class = " wrap " > Модификация предметов . Наши мастера помогут вам модифицировать ваши доспехи . К сожалению , -->
<!-- технология не позволяет повторно модифицировать вещи . Чем выше у вас интеллект , тем яснее вы сможете -->
<!-- объяснить мастерам желаемый результат . Результат может быть непредсказуем !</ span >-->
<!--</ div >-->
<!--< div class = " appblock " >-->
<!-- < span class = " legend " > Экспериментальный цех </ span >-->
<!-- < form method = " post " >-->
<!-- < input type = " hidden " name = " goto " value = " modding " >-->
<!-- < input type = " submit " value = " Войти " >-->
<!-- </ form >-->
<!-- < span class = " wrap " > Подгонка предметов . И прочие нерегулярные штуки .</ span >-->
<!--</ div >-->
2018-12-12 14:23:58 +00:00
< div style = " clear: both; " >
< ? php if ( isset ( $status )) : ?>
< span class = " wrap " >< ? = $status ?> </span>
< ? php endif ; ?>
</ div >
2018-12-12 14:37:00 +00:00
< ? php if ( input :: post ( 'goto' ) == 'remont' ) :
2018-12-12 14:48:43 +00:00
while ( $row = $remont_query -> fetch_assoc ()) : ?>
2018-12-12 14:37:00 +00:00
< div class = " appblock " >
< span class = " legend " >< ? = $row [ 'name' ] ?> </span>
2018-12-12 16:09:39 +00:00
< span class = " wrap " > Состояние предмета < span class = " num " >< ? = $row [ 'duration' ] ?> /<?= $row['maxdur'] ?></span></span>
2018-12-12 17:16:36 +00:00
< span class = " wrap " > Стоимость услуги < span class = " num " >< ? = ceil ( $row [ 'duration' ] / 2 ) ?> </span></span>
2018-12-12 14:37:00 +00:00
< div style = " text-align: center " >
2018-12-12 16:14:22 +00:00
< img src = " i/sh/<?= $row['img'] ?> " >
2018-12-12 16:09:39 +00:00
< form method = " post " >
< input type = " hidden " name = " itemId " value = " <?= $row['id'] ?> " >
< input type = " hidden " name = " action " value = " repair " >
< input type = " submit " value = " Ремонт " >
</ form >
2018-12-12 14:37:00 +00:00
</ div >
</ div >
< ? php endwhile ; endif ; ?>
2018-12-12 14:58:41 +00:00
< ? php if ( input :: post ( 'goto' ) == 'gravirovka' ) :
while ( $row = $gravirovka_query -> fetch_assoc ()) : ?>
< div class = " appblock " >
< span class = " legend " >< ? = $row [ 'name' ] ?> </span>
2018-12-12 17:16:36 +00:00
< span class = " wrap " > Стоимость услуги < span class = " num " > 30 </ span ></ span >
2018-12-12 14:58:41 +00:00
< div style = " text-align: center " >
2018-12-12 17:16:36 +00:00
< ? php if ( empty ( $row [ 'text' ])) : ?>
< form method = " post " id = " gravirovka " >
< input maxlength = " 32 " placeholder = " Текст гравировки " name = " gravirovka_text " >
2018-12-12 17:19:25 +00:00
< br >< img src = " i/sh/<?= $row['img'] ?> " >< br >
2018-12-12 17:16:36 +00:00
< input type = " hidden " name = " itemId " value = " <?= $row['id'] ?> " >
< input type = " submit " value = " Добавить надпись " >
</ form >
< ? php else : ?>
< form method = " post " id = " gravirovka " >
< input value = " <?= $row['text'] ?> " readonly title >
2018-12-12 17:19:25 +00:00
< br >< img src = " i/sh/<?= $row['img'] ?> " >< br >
2018-12-12 17:16:36 +00:00
< input type = " hidden " name = " gravirovka_remove " value = " <?= $row['id'] ?> " >
< input type = " submit " value = " Удалить надпись " >
</ form >
< ? php endif ; ?>
2018-12-12 14:58:41 +00:00
</ div >
</ div >
< ? php endwhile ; endif ; ?>
2018-12-12 18:59:19 +00:00
<!--
< TABLE WIDTH = 100 % BGCOLOR = " #A5A5A5 " >
< ? php
if ( input :: post ( 'goto' ) == 'magic' ) {
$data = mysql_query ( " SELECT * FROM `inventory` WHERE `owner` = ' { $user [ 'id' ] } ' AND `dressed` = 0 AND `includemagicmax` > 0 AND `setsale`=0 ORDER by `update` DESC; " );
while ( $row = mysql_fetch_array ( $data )) {
?>
< TR bgcolor =< ? = $color ?> >
< TD align = center >< IMG SRC = " i/sh/<?= $row['img'] ?> " BORDER = 0 > " ;
< BR >
< small >
< ?
if ( $row [ 'includemagicdex' ] == 0 ) {
?> <A HREF="?razdel=2&it=<?= $row['id'] ?>">Перезарядить
за < ? = $row [ 'includemagiccost' ] ?> кр.</A><BR><?
2018-12-12 15:18:19 +00:00
} else {
2018-12-12 18:59:19 +00:00
echo 'Н е нуждается в перезарядке' ;
2018-12-12 15:18:19 +00:00
}
?>
2018-12-12 18:59:19 +00:00
</ small >
</ TD >
2019-01-16 20:20:47 +00:00
< TD valign = top >< ? php #showitem($row) ?></TD>
2018-12-12 18:59:19 +00:00
</ TR >
< ? php
}
}
2018-12-11 23:20:11 +00:00
2018-12-12 18:59:19 +00:00
if ( input :: post ( 'goto' ) == 'modding' ) {
$data = mysql_query ( " SELECT * FROM `inventory` WHERE `type` < 12 AND `type` != 3 AND `owner` = ' { $_SESSION [ 'uid' ] } ' AND `dressed` = 0 AND `name` NOT LIKE '% (мф)%' AND `name` NOT LIKE '%Букет%' AND `setsale`=0 ORDER by `update` DESC; " );
while ( $row = mysql_fetch_array ( $data )) {
?>
< TR bgcolor =< ? = $color ?> >
< TD align = center >< IMG SRC = " i/sh/<?= $row['img'] ?> " BORDER = 0 > " ;
< BR >
< small >
< A HREF = " ?razdel=3&mf=<?= $row['id'] ?> "
onClick = " if(!confirm('Вы действительно хотите модифицировать эту вещь?')) { return false;} " > Модифицировать
за < ? = $row [ 'cost' ] ?> кр.</A><BR>
</ small >
</ TD >
2019-01-16 20:20:47 +00:00
< TD valign = top >< ? php #showitem($row) ?></TD>
2018-12-12 18:59:19 +00:00
</ TR >
< ? php
}
}
2018-12-11 23:20:11 +00:00
2018-12-12 18:59:19 +00:00
if ( input :: post ( 'goto' ) == 'podgon' ) {
$data = mysql_query ( " SELECT * FROM `inventory` WHERE `type` < 12 AND `type` != 3 AND `owner` = ' { $user [ 'id' ] } ' AND `dressed` = 0 AND `modif`='1' AND `podgon`<'5' AND `name` NOT LIKE '%Букет%' AND `setsale`=0 ORDER by `update` DESC; " );
while ( $row = mysql_fetch_array ( $data )) {
?>
< TR bgcolor =< ? = $color ?> >
< TD align = center >< IMG SRC = " i/sh/<?= $row['img'] ?> " BORDER = 0 > " ;
< BR >
< small >
< ?
if ( $row [ 'point' ] > 0 ) {
$babki = round (( $row [ 'point' ] / 2 ), 0 );
$cost_t = 'Реп' ;
2018-12-12 15:18:19 +00:00
} else {
2018-12-12 18:59:19 +00:00
$babki = round (( $row [ 'cost' ] / 2 ), 0 );
$cost_t = 'К р ' ;
2018-12-12 15:18:19 +00:00
}
?>
2018-12-12 18:59:19 +00:00
< A HREF = " ?razdel=4&podgon=<?= $row['id'] ?> "
onclick = " if(!confirm('Вы действительно хотите подогнать эту вещь?')) { return false;} " > Подогнать
за < ? = $babki ?> <?= $cost_t ?>.</A><BR>
</ small >
</ TD >
2019-01-16 20:20:47 +00:00
< TD valign = top >< ? php #showitem($row) ?></TD>
2018-12-12 18:59:19 +00:00
</ TR >
< ? php
}
}
?>
2018-01-28 16:40:49 +00:00
</ TABLE >
2018-12-12 18:59:19 +00:00
-->
2018-01-28 16:40:49 +00:00
</ body >
</ html >