2023-03-31 18:42:06 +00:00
< ? php
2022-06-06 21:30:34 +00:00
if ( ! defined ( 'GAME' ))
{
die ();
}
if ( isset ( $po [ 'finish_file' ]) && $po [ 'finish_file' ] == 'tznanie' )
{
2023-01-10 16:29:32 +00:00
//Добавляем слот
2022-06-06 21:30:34 +00:00
mysql_query ( 'UPDATE `actions` SET `val` = "cast" WHERE (`vals` = "1044" OR `vals` = "1045" OR `vals` = "1046" OR `vals` = "1047") AND `val` != "cast" AND `vars` = "read" AND `uid` = "' . $u -> info [ 'id' ] . '" LIMIT 1' );
} else {
$st [ 'timeRead' ] = 0 ;
//$tst = $u->testAction('`uid` = "'.$u->info['id'].'" AND `time` > '.time().' AND `vars` = "read" LIMIT 1',1);
if ( isset ( $tst [ 'id' ]))
{
2023-01-10 16:29:32 +00:00
//Уже что-то изучаем
$u -> error = 'Так не пойдет, вы уже что-то изучаете' ;
2022-06-06 21:30:34 +00:00
} else {
$tst = $u -> testAction ( '`uid` = "' . $u -> info [ 'id' ] . '" AND `vars` = "read" AND `vals` = "' . $itm [ 'item_id' ] . '" LIMIT 1' , 1 );
if ( isset ( $tst [ 'id' ]))
{
2023-01-10 16:29:32 +00:00
$u -> error = 'Вы уже изучили данное знание' ;
2022-06-06 21:30:34 +00:00
} else {
$fn = '' ; $tom_iz = 0 ;
if (( $itm [ 'item_id' ] >= 1045 && $itm [ 'item_id' ] <= 1047 ) || ( $itm [ 'item_id' ] >= 4812 && $itm [ 'item_id' ] <= 4813 ))
{
$tst2 = $u -> testAction ( '`uid` = "' . $u -> info [ 'id' ] . '" AND `vars` = "read" AND `vals` = "' . ( $itm [ 'item_id' ] - 1 ) . '" LIMIT 1' , 1 );
if ( ! isset ( $tst2 [ 'id' ]))
{
$tom_iz = 1 ;
}
unset ( $tst2 );
}
/*
if ( $itm [ 'item_id' ] == 4811 ) {
2023-01-10 16:29:32 +00:00
//5 том знаний, нужен 1047
2022-06-06 21:30:34 +00:00
$tst2 = $u -> testAction ( '`uid` = "' . $u -> info [ 'id' ] . '" AND `vars` = "read" AND `vals` = "1047" LIMIT 1' , 1 );
if ( ! isset ( $tst2 [ 'id' ]))
{
$tom_iz = 1 ;
}
unset ( $tst2 );
}
*/
if ( $tom_iz == 0 )
{
if (( $itm [ 'item_id' ] >= 1044 && $itm [ 'item_id' ] <= 1047 ) || $itm [ 'item_id' ] == 4813 || $itm [ 'item_id' ] == 4812 )
{
mysql_query ( 'UPDATE `stats` SET `priemslot` = `priemslot` + 1 WHERE `id` = "' . $itm [ 'uid' ] . '" LIMIT 1' );
$fn .= 'finish_file=tznanie' ;
}
if ( $itm [ 'item_id' ] == 4811 )
{
mysql_query ( 'UPDATE `stats` SET `priemslot` = `priemslot` + 2 WHERE `id` = "' . $itm [ 'uid' ] . '" LIMIT 1' );
$fn .= 'finish_file=tznanie' ;
}
2023-01-10 16:29:32 +00:00
//$ins = mysql_query('INSERT INTO `eff_users` (`overType`,`id_eff`,`uid`,`name`,`timeUse`,`data`,`img2`,`no_Ace`) VALUES ("8","2","'.$u->info['id'].'","Изучение: '.$itm['name'].'","'.(time()+$st['timeRead']).'","'.$fn.'","'.$itm['img'].'","1")');
2022-06-06 21:30:34 +00:00
//if($ins)
//{
2023-01-10 16:29:32 +00:00
//$u->error = 'Вы начали изучать "'.$itm['name'].'". Время изучения составит '.$u->timeOut($st['timeRead']).'';
$u -> error = 'Вы изучили "' . $itm [ 'name' ] . '".' ;
2022-06-06 21:30:34 +00:00
$u -> addAction ( time () + $st [ 'timeRead' ], 'read' , $itm [ 'item_id' ]);
mysql_query ( 'UPDATE `items_users` SET `iznosNOW` = `iznosNOW` + 1 WHERE `id` = ' . $itm [ 'id' ] . ' LIMIT 1' );
//}else{
2023-01-10 16:29:32 +00:00
// $u->error = 'Что-то здесь не так';
2022-06-06 21:30:34 +00:00
//}
} else {
2023-01-10 16:29:32 +00:00
$u -> error = 'Требует изучения предыдущего тома' ;
2022-06-06 21:30:34 +00:00
}
unset ( $tom_iz );
}
}
}
?>