2018-01-28 16:40:49 +00:00
< ? php
session_start ();
if ( ! ( $_SESSION [ 'uid' ] > 0 )) header ( " Location: index.php " );
include " config.php " ;
$user = mysql_fetch_array ( mysql_query ( " SELECT * FROM `users` WHERE `id` = ' { $_SESSION [ 'uid' ] } ' LIMIT 1; " ));
include " functions.php " ;
if ( $user [ 'room' ] != 53 ) { header ( " Location: main.php " ); die (); }
if ( $user [ 'battle' ] != 0 ) { header ( 'location: fbattle.php' ); die (); }
?>
< HTML >< HEAD >
< link rel = stylesheet type = " text/css " href = " css/main.css " >
< meta content = " text/html; charset=utf-8 " http - equiv = Content - type >
< META Http - Equiv = Cache - Control Content = no - cache >
< meta http - equiv = PRAGMA content = NO - CACHE >
< META Http - Equiv = Expires Content = 0 >
</ HEAD >
< body leftmargin = 5 topmargin = 5 marginwidth = 5 marginheight = 5 bgcolor = #d4d4d4>
< TABLE border = 0 width = 600 cellspacing = " 0 " cellpadding = " 0 " align = left >
< tr >< td >< h3 > Библиотека Просвещения </ td ></ tr >
< ? php
if ( $_GET [ 'lib_room' ] == 'hall' || ! $_GET [ 'lib_room' ])
{
echo ( ' < tr >< td > Вы стоите в холле Библиотеки . В застоявшемся воздухе висит многовековая пыль , плавно витающая между полками и сундуками с книгами .
Потолки залов теряются в темноте , которую разгоняют лишь факелы на стенах .</ td ></ tr > ' );
echo ( '<tr><td><br/>К Вам подходит один из Смотрителей. Он определенно стар, лицо скрыто под плащем, но е г о движения - быстрые и точные. </td></tr>' );
echo ( '<tr><td><br/><em>Смотритель</em>: <strong>"Какие услуги тебе понадобились?"</strong><hr/> </td></tr>' );
echo ' < tr >< td >< br />< FORM action = " library.php " method = GET >
< INPUT TYPE = " hidden " name = " lib_room " value = " archive " >
< INPUT TYPE = " submit " value = " Архив " >
< br /> Здесь ученые мужи трудятся над рашифровкой древних книг и свитков . Если Вам нужна информация про какие - либо книги или свитки ,
здесь Вам обязательно помогут .
</ FORM ></ td ></ tr > ' ;
echo ' < tr >< td >< br />< FORM action = " library.php " method = GET >
< INPUT TYPE = " hidden " name = " lib_room " value = " magic_craft " >
< INPUT TYPE = " submit " value = " Мастерская " >
< br /> Оснащенная по последнему слову магии и техники лаборатория для опытов . Тут Вы можете создавать магические предметы .</ FORM >
</ td ></ tr > ' ;
echo ( '<tr><td><FORM action="city.php" method=GET><INPUT TYPE="submit" value="Вернуться в Город" name="kz"></FORM></td></tr>' );
//echo '<tr><td><FORM action="library.php" method=GET><INPUT TYPE="submit" value="Опознать вещи" name="ident_book"></FORM></td></tr>';
//echo '<tr><td><FORM action="library.php" method=GET><INPUT TYPE="submit" value="Купить свитки" name="ident_book"></FORM></td></tr>';
}
elseif ( $_GET [ 'lib_room' ] == 'archive' )
{
//код опознавания страниц
if ( $_POST [ 'ident_pages' ])
{
//выбираем неопределенные страницы
$pages = array ();
$pages_res = mysql_query ( " SELECT `id` FROM `inventory` WHERE `owner`=' { $user [ 'id' ] } ' AND `prototype`='867' AND `dressed`='0'; " );
while ( $page_res = mysql_fetch_array ( $pages_res ))
$pages [] = $page_res [ 'id' ];
$names = array ();
$cred = 0 ;
foreach ( $pages as $p )
{
if ( mt_rand ( 1 , 2 ) == 1 )
{
$page_num = 868 + mt_rand ( 0 , 14 );
$dress = mysql_fetch_array ( mysql_query ( " SELECT * FROM `shop` WHERE `id` = ' { $page_num } ' LIMIT 1; " ));
mysql_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` , `gmp` , `gmeshok` , `encicl` , `artefact` , `duration`
)
VALUES
( '{$dress[' id ']}' , '{$user[id]}' , '{$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 ']}' , '".(($dress[' goden '])?($dress[' goden ']*24*60*60+time()):"")."' , '{$dress[' goden ']}' , '{$dress[' razdel ']}' , '{$dress[' gmp ']}' , '{$dress[' gmeshok ']}' , '{$dress[' encicl ']}' , '{$dress[' artefact ']}' , '0'
) ; " );
$names [] = $dress [ 'name' ];
}
else
$cred += 1 ;
mysql_query ( " DELETE FROM `inventory` WHERE `id` = ' { $p } ' LIMIT 1; " );
}
}
//текст
echo ( ' < tr >< td > Перед Вами длинный зал , заполненный людьми в серых р о б а х . Некоторые внимательно изучают всевозможные вещи и книги , другие
в небольших группах что - то оживленно обсуждают . В углу помещения стоит каменная плита с неизвестными Вам символами .</ td ></ tr > ' );
if ( $_POST [ 'ident_pages' ]) echo ( '<tr><td><br/>З а столом слева от входа сгорбился Архивариус. Он не обращает на В а с никакого внимания.</td></tr>' );
else echo ( ' < tr >< td >< br /> З а столом слева от входа сгорбился Архивариус . Он медленно поднимает голову и смотрим Вам прямо в глаза .</ td ></ tr >
< tr >< td >< br />< em > Архивариус </ em >: < strong > " Предметы не определяем. Чеки не принимаем. С вопросами - к помощникам. " </ strong >< hr /></ td ></ tr > ' );
//выбираем неопределенные страницы
$pages = array ();
$pages_res = mysql_query ( " SELECT `id` FROM `inventory` WHERE `owner`=' { $user [ 'id' ] } ' AND `prototype`='867' AND `dressed`='0'; " );
while ( $page_res = mysql_fetch_array ( $pages_res ))
$pages [] = $page_res [ 'id' ];
//обмен страниц
if ( $pages )
echo ( ' < tr >< td > Здесь Вам помогут опознать найденные Вами страницы
< FORM action = " '. $_SERVER['REQUEST_URI'] .' " method = POST > ( < strong > '.count($pages).' </ strong > ) шт . - < INPUT TYPE = " submit " value = " Опознать " name = " ident_pages " >
</ FORM ></ td ></ tr > ' );
else echo ( '<tr><td>У В а с нету страниц, нуждающихся в идентификации.</td></tr>' );
//money
if ( $cred )
{
mysql_query ( " UPDATE `users` SET `money`=money+ { $cred } where `id`=' { $user [ 'id' ] } '; " );
echo ( '<tr><td><br/>Вы отдали ненужные страницы в Архив <strong>(+' . $cred . ')кр.</strong></td></tr>' );
}
//ident
if ( $names ) foreach ( $names as $n )
{
echo ( '<tr><td><br/>Вы получили <strong>' . $n . '</strong></td></tr>' );
mysql_query ( " INSERT INTO `delo` (`id` , `author` ,`pers`, `text`, `type`, `date`)
VALUES ( '' , '0' , '{$user[' id ']}' , '\"".$user[' login ']."\" получил в Библиотеке ".$n." кр. ' , 1 , '".time()."' ); " );
}
//меняем страницы на книгу
if ( $_POST [ 'get_book' ])
{
$pages = array ();
$got_all_1 = 1 ;
for ( $pn = 868 ; $pn <= 882 ; $pn ++ )
{
$pc_r = mysql_fetch_array ( mysql_query ( " SELECT `id` FROM `inventory` WHERE `owner`=' { $user [ 'id' ] } ' AND `prototype`=' { $pn } ' LIMIT 1; " ));
if ( $pc_r ) $pages [] = $pc_r [ 'id' ];
else $got_all_1 = 0 ;
}
if ( $got_all_1 ) {
foreach ( $pages as $p )
mysql_query ( " DELETE FROM `inventory` WHERE `id` = ' { $p } ' LIMIT 1; " );
$dress = mysql_fetch_array ( mysql_query ( " SELECT * FROM `shop` WHERE `id` = '866' LIMIT 1; " ));
mysql_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` , `gmp` , `gmeshok` , `encicl` , `artefact` , `duration`
)
VALUES
( '{$dress[' id ']}' , '{$user[id]}' , '{$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 ']}' , '".(($dress[' goden '])?($dress[' goden ']*24*60*60+time()):"")."' , '{$dress[' goden ']}' , '{$dress[' razdel ']}' , '{$dress[' gmp ']}' , '{$dress[' gmeshok ']}' , '{$dress[' encicl ']}' , '{$dress[' artefact ']}' , '0'
) ; " );
2018-03-04 00:09:58 +00:00
addchp ( 'У В а с есть все необходимые страницы. Сложив их в нужном порядке, Вы получаете <strong>Книгу Комментатора [1]' , '{[]}' . nick :: id ( $user [ 'id' ]) -> short () . '{[]}' );
2018-01-28 16:40:49 +00:00
}
}
//есть страницы
$pagesn = array ();
for ( $pn = 868 ; $pn <= 882 ; $pn ++ ) //книга 1
{
$pc_r = mysql_fetch_array ( mysql_query ( " SELECT `id` FROM `inventory` WHERE `owner`=' { $user [ 'id' ] } ' AND `prototype`=' { $pn } ' LIMIT 1; " ));
if ( $pc_r ) $pagesn [ $pn ] = 1 ;
else $pagesn [ $pn ] = 0 ;
}
echo ( '<tr><td><br/>Найденные страницы:</td></tr>' );
echo ( '<tr><td><strong>Книга Комментатора [1]</strong>:</td></tr>' );
echo ( '<tr><td>' );
foreach ( $pagesn as $p )
{
$c ++ ;
if ( $p > 0 ) echo ( " <b> " . $c . " </b> " );
else echo ( " <font color=#777777> " . $c . " </font> " );
}
$got_all_1 = 1 ;
for ( $pn = 868 ; $pn <= 882 ; $pn ++ )
{
$pc_r = mysql_fetch_array ( mysql_query ( " SELECT `id` FROM `inventory` WHERE `owner`=' { $user [ 'id' ] } ' AND `prototype`=' { $pn } ' LIMIT 1; " ));
if ( $pc_r ) $pages [] = $pc_r ;
else $got_all_1 = 0 ;
}
if ( $got_all_1 )
echo ( '</td></tr><tr><td><FORM action="' . $_SERVER [ 'REQUEST_URI' ] . ' " method=POST><INPUT TYPE= " submit " value= " Собрать книгу " name= " get_book " >
</ FORM ></ td ></ tr > ' );
else
echo ( " <tr><td><em>Н е хватает страниц</em></td></tr> " );
echo ( '<tr><td><FORM action="library.php" method=POST><INPUT TYPE="submit" value="Вернуться в Холл"></FORM></td></tr>' );
}
elseif ( $_GET [ 'lib_room' ] = 'magic_craft' )
{
/* books = array ();
$pages_res = mysql_query ( " SELECT `id` FROM `inventory` WHERE `owner`=' { $user [ 'id' ] } ' AND `prototype`='867' AND `dressed`='0'; " );
while ( $page_res = mysql_fetch_array ( $pages_res )) */
$res = array ();
$del = array ();
$book_1 = mysql_fetch_array ( mysql_query ( " SELECT `id` FROM `inventory` WHERE `owner`=' { $user [ 'id' ] } ' AND `prototype`='866' LIMIT 1; " ));
//делаем крафт
if ( $_POST [ 'craft_1' ]) {
$craft_err = 0 ;
//считаем книжку
if ( ! $book_1 ) $craft_err = 1 ;
//считаем ингридиенты
$ing = mysql_fetch_array ( mysql_query ( " SELECT `ingred` FROM `recipes` WHERE `id`=' { $_POST [ 'magic_id' ] } ' LIMIT 1; " ));
$need_1 = unserialize ( $ing [ 'ingred' ]);
//считаем кол-во ингридиентов
foreach ( $need_1 as $k => $n ) {
$res_r = mysql_query ( " SELECT `id` FROM `inventory` WHERE `owner`=' { $user [ 'id' ] } ' AND `prototype`=' { $k } '; " );
$i = 0 ;
while ( $res_id = mysql_fetch_array ( $res_r ))
if ( $i < $n )
{
if ( $res_id [ 'id' ]) $del [] = $res_id [ 'id' ];
else
$craft_err = 1 ;
$i ++ ;
}
}
//ингридиентов хватает
if ( ! $craft_err ) {
foreach ( $del as $d )
mysql_query ( " DELETE FROM `inventory` WHERE `id`=' { $d } '; " );
$dress = mysql_fetch_array ( mysql_query ( " SELECT * FROM `shop` WHERE `id` = ' { $_POST [ 'magic_id' ] } ' LIMIT 1; " ));
mysql_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` , `gmp` , `gmeshok` , `encicl` , `artefact` , `duration`
)
VALUES
( '{$dress[' id ']}' , '{$user[id]}' , '{$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 ']}' , '".(($dress[' goden '])?($dress[' goden ']*24*60*60+time()):"")."' , '{$dress[' goden ']}' , '{$dress[' razdel ']}' , '{$dress[' gmp ']}' , '{$dress[' gmeshok ']}' , '{$dress[' encicl ']}' , '{$dress[' artefact ']}' , '0'
) ; " );
mysql_query ( " INSERT INTO `delo` (`id` , `author` ,`pers`, `text`, `type`, `date`)
VALUES ( '' , '0' , '{$user[' id ']}' , '\"".$user[' login ']."\" создал свиток ".$dress[' name ']." ' , 1 , '".time()."' ); " );
2018-03-04 00:09:58 +00:00
addchp ( 'Вы успешно создали свиток <strong>' . $dress [ 'name' ] . '</strong>!' , '{[]}' . nick :: id ( $user [ 'id' ]) -> short () . '{[]}' );
2018-01-28 16:40:49 +00:00
}
}
//$book1=mysql_fetch_array(mysql_query("SELECT `id` FROM `inventory` WHERE `owner`='{$user['id']}' AND `prototype`='--book 2--'; "));
//$book1=mysql_fetch_array(mysql_query("SELECT `id` FROM `inventory` WHERE `owner`='{$user['id']}' AND `prototype`='--book 3--'; "));
echo ( ' < tr >< td > Вы стоите в небольшой комнате , от пола до потолка забтиой банками , пробирками , ингредиентами и прочими полезными вещами .
Здесь Вы можете собрать предметы по имеющимся у В а с рецептам .< br />< br />< IMG align = left alt = " Знак зодиака " height = 99 src = " i/');
//выводим знак зодиака
echo star_sign ( substr ( $user [ 'borndate' ], 3 , 2 ), substr ( $user [ 'borndate' ], 0 , 2 ));
echo ( '.gif" width=100>' );
//выводим инфо по стихиям
echo ( 'Ваша стихия:' );
$el = element ( star_sign ( substr ( $user [ 'borndate' ], 3 , 2 ), substr ( $user [ 'borndate' ], 0 , 2 )));
switch ( $el )
{
case 'a' : echo ( " <strong><font color=#0198ef><ins>Воздух</ins></font></strong> " ); break ;
case 'w' : echo ( " <strong><font color=#0d2b99><ins>Вода</ins></font></strong> " ); break ;
case 'f' : echo ( " <strong><font color=#df0d0d><ins>Огонь</ins></font></strong> " ); break ;
case 'e' : echo ( " <strong><font color=#086604><ins>Земля</ins></font></strong> " ); break ;
}
echo ( " <br/>Эффективность магии: " );
foreach ( $elem_align as $k => $ea )
{
switch ( $k )
{
case 'a' : echo ( " <br/><font color=#0198ef>Воздух</font> " ); break ;
case 'w' : echo ( " <br/><font color=#0d2b99>Вода</font> " ); break ;
case 'f' : echo ( " <br/><font color=#df0d0d>Огонь</font> " ); break ;
case 'e' : echo ( " <br/><font color=#086604>Земля</font> " ); break ;
}
switch ( $ea [ $el ])
{
case '0' : echo ( " : <font color=gray> " . ( $ea [ $el ] * 100 ) . " %</font> " ); break ;
case '0.5' : echo ( " : " . ( $ea [ $el ] * 100 ) . " % " ); break ;
case '1' : echo ( " : <b> " . ( $ea [ $el ] * 100 ) . " %</b> " ); break ;
}
}
;
echo ( '</td></tr>' );
if ( $craft_err ) echo ( " <tr><td><font color=red>Недостаточно ингредиентов!</font></td></tr> " );
if ( $book_1 ) {
echo ( '<tr><td><hr/>Рецепты: <strong>Книга Комментатора [1]</strong></td></tr>' );
//ОГОНЬ
echo ( '<tr><td><br/><strong><font color=#df0d0d>Магия Огня</font></strong><br/><br/></td></tr>' );
//выбираем всю магию стихии
$all_fire_raw = mysql_query ( " SELECT * FROM `recipes` WHERE `level`='1' AND `elem`='F'; " );
while ( $all_fire = mysql_fetch_array ( $all_fire_raw ))
{
$spell_info = mysql_fetch_array ( mysql_query ( " SELECT `name`,`img` FROM `shop` WHERE `id`=' { $all_fire [ 'id' ] } ' LIMIT 1; " ));
//необходимые ингридиенты
$ing = unserialize ( $all_fire [ 'ingred' ]);
foreach ( $ing as $k => $n ) {
$txt_k = mysql_fetch_array ( mysql_query ( " SELECT `name` FROM `shop` WHERE `id`=' { $k } ' LIMIT 1; " ));
$count_k = mysql_num_rows ( mysql_query ( " SELECT `id` FROM `inventory` WHERE `owner`=' { $user [ 'id' ] } ' AND `prototype`=' { $k } '; " ));
if ( $count_k < $n )
{
$ingred .= $txt_k [ 'name' ] . " (<font color=red> " . $count_k . " / " . $n . " </font>)<br/> " ;
$ing_error = 1 ;
}
else
$ingred .= $txt_k [ 'name' ] . " (<b> " . $count_k . " / " . $n . " </b>)<br/> " ;
}
echo ( '<tr><td><FORM action="' . $_SERVER [ 'REQUEST_URI' ] . '" method=POST><b><img src="i/magic/' . $spell_info [ 'img' ] . '">' .
$spell_info [ 'name' ] . '</b><INPUT TYPE="hidden" name="magic_id" value="' . $all_fire [ 'id' ] . '"><br/><ins>Ингредиенты</ins>:<br/>' .
$ingred );
unset ( $ing );
unset ( $ingred );
if ( ! $ing_error ) echo ( '<INPUT TYPE="submit" value="Создать" name="craft_1">' ); else echo ( " <font color=red><i>Недостаточно ингридиентов</i></font> " );
echo ( '</FORM></td></tr>' );
}
//ЗЕМЛЯ
echo ( '<tr><td><br/><strong><font color=#086604>Магия Земли</font></strong><br/><br/></td></tr>' );
//выбираем всю магию стихии
$all_earth_raw = mysql_query ( " SELECT * FROM `recipes` WHERE `level`='1' AND `elem`='E'; " );
while ( $all_earth = mysql_fetch_array ( $all_earth_raw ))
{
$spell_info = mysql_fetch_array ( mysql_query ( " SELECT `name`,`img` FROM `shop` WHERE `id`=' { $all_earth [ 'id' ] } ' LIMIT 1; " ));
//необходимые ингридиенты
$ing = unserialize ( $all_earth [ 'ingred' ]);
foreach ( $ing as $k => $n ) {
$txt_k = mysql_fetch_array ( mysql_query ( " SELECT `name` FROM `shop` WHERE `id`=' { $k } ' LIMIT 1; " ));
$count_k = mysql_num_rows ( mysql_query ( " SELECT `id` FROM `inventory` WHERE `owner`=' { $user [ 'id' ] } ' AND `prototype`=' { $k } '; " ));
if ( $count_k < $n )
{
$ingred .= $txt_k [ 'name' ] . " (<font color=red> " . $count_k . " / " . $n . " </font>)<br/> " ;
$ing_error = 1 ;
}
else
$ingred .= $txt_k [ 'name' ] . " (<b> " . $count_k . " / " . $n . " </b>)<br/> " ;
}
echo ( '<tr><td><FORM action="' . $_SERVER [ 'REQUEST_URI' ] . '" method=POST><b><img src="i/magic/' . $spell_info [ 'img' ] . '">' .
$spell_info [ 'name' ] . '</b><INPUT TYPE="hidden" name="magic_id" value="' . $all_earth [ 'id' ] . '"><br/><ins>Ингредиенты</ins>:<br/>' .
$ingred );
unset ( $ing );
unset ( $ingred );
if ( ! $ing_error ) echo ( '<INPUT TYPE="submit" value="Создать" name="craft_1">' ); else echo ( " <font color=red><i>Недостаточно ингридиентов</i></font> " );
echo ( '</FORM></td></tr>' );
}
//ВОЗДУХ
echo ( '<tr><td><br/><strong><font color=#0198ef>Магия Воздуха</font></strong><br/><br/></td></tr>' );
//выбираем всю магию стихии
$all_air_raw = mysql_query ( " SELECT * FROM `recipes` WHERE `level`='1' AND `elem`='A'; " );
while ( $all_air = mysql_fetch_array ( $all_air_raw ))
{
$spell_info = mysql_fetch_array ( mysql_query ( " SELECT `name`,`img` FROM `shop` WHERE `id`=' { $all_air [ 'id' ] } ' LIMIT 1; " ));
//необходимые ингридиенты
$ing = unserialize ( $all_air [ 'ingred' ]);
foreach ( $ing as $k => $n ) {
$txt_k = mysql_fetch_array ( mysql_query ( " SELECT `name` FROM `shop` WHERE `id`=' { $k } ' LIMIT 1; " ));
$count_k = mysql_num_rows ( mysql_query ( " SELECT `id` FROM `inventory` WHERE `owner`=' { $user [ 'id' ] } ' AND `prototype`=' { $k } '; " ));
if ( $count_k < $n )
{
$ingred .= $txt_k [ 'name' ] . " (<font color=red> " . $count_k . " / " . $n . " </font>)<br/> " ;
$ing_error = 1 ;
}
else
$ingred .= $txt_k [ 'name' ] . " (<b> " . $count_k . " / " . $n . " </b>)<br/> " ;
}
echo ( '<tr><td><FORM action="' . $_SERVER [ 'REQUEST_URI' ] . '" method=POST><b><img src="i/magic/' . $spell_info [ 'img' ] . '">' .
$spell_info [ 'name' ] . '</b><INPUT TYPE="hidden" name="magic_id" value="' . $all_air [ 'id' ] . '"><br/><ins>Ингредиенты</ins>:<br/>' .
$ingred );
unset ( $ing );
unset ( $ingred );
if ( ! $ing_error ) echo ( '<INPUT TYPE="submit" value="Создать" name="craft_1">' ); else echo ( " <font color=red><i>Недостаточно ингридиентов</i></font> " );
echo ( '</FORM></td></tr>' );
}
//ВОДА
echo ( '<tr><td><br/><strong><font color=#0d2b99>Магия Воды</font></strong><br/><br/></td></tr>' );
//выбираем всю магию стихии
$all_fire_raw = mysql_query ( " SELECT * FROM `recipes` WHERE `level`='1' AND `elem`='W'; " );
while ( $all_fire = mysql_fetch_array ( $all_fire_raw ))
{
$spell_info = mysql_fetch_array ( mysql_query ( " SELECT `name`,`img` FROM `shop` WHERE `id`=' { $all_fire [ 'id' ] } ' LIMIT 1; " ));
//необходимые ингридиенты
$ing = unserialize ( $all_fire [ 'ingred' ]);
foreach ( $ing as $k => $n ) {
$txt_k = mysql_fetch_array ( mysql_query ( " SELECT `name` FROM `shop` WHERE `id`=' { $k } ' LIMIT 1; " ));
$count_k = mysql_num_rows ( mysql_query ( " SELECT `id` FROM `inventory` WHERE `owner`=' { $user [ 'id' ] } ' AND `prototype`=' { $k } '; " ));
if ( $count_k < $n )
{
$ingred .= $txt_k [ 'name' ] . " (<font color=red> " . $count_k . " / " . $n . " </font>)<br/> " ;
$ing_error = 1 ;
}
else
$ingred .= $txt_k [ 'name' ] . " (<b> " . $count_k . " / " . $n . " </b>)<br/> " ;
}
echo ( '<tr><td><FORM action="' . $_SERVER [ 'REQUEST_URI' ] . '" method=POST><b><img src="i/magic/' . $spell_info [ 'img' ] . '">' .
$spell_info [ 'name' ] . '</b><INPUT TYPE="hidden" name="magic_id" value="' . $all_fire [ 'id' ] . '"><br/><ins>Ингредиенты</ins>:<br/>' .
$ingred );
unset ( $ing );
unset ( $ingred );
if ( ! $ing_error ) echo ( '<INPUT TYPE="submit" value="Создать" name="craft_1">' ); else echo ( " <font color=red><i>Недостаточно ингридиентов</i></font> " );
echo ( '</FORM></td></tr>' );
}
}
if ( $book2 )
{
}
if ( $book3 )
{
}
echo ( '<tr><td><br/><FORM action="library.php" method=POST><INPUT TYPE="submit" value="Вернуться в Холл"></FORM></td></tr>' );
}
?>
</ table >
< ? php
if ( $_GET [ 'lib_room' ] == 'hall' || ! $_GET [ 'lib_room' ])
$the_room = 'library' ;
elseif ( $_GET [ 'lib_room' ] == 'archive' )
$the_room = 'archive' ;
elseif ( $_GET [ 'lib_room' ] = 'magic_craft' )
$the_room = 'magic_craft' ;
echo ( '<div align=right><img width="260" src="i/library/' . $the_room . '.jpg" /></div>' );
?>
</ BODY >
</ HTML >