game/_incl_data/class/magic/tznanie.php
2022-06-07 00:30:34 +03:00

74 lines
2.6 KiB
PHP

<?
if(!defined('GAME'))
{
die();
}
if(isset($po['finish_file']) && $po['finish_file']=='tznanie')
{
//Äîáàâëÿåì ñëîò
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']))
{
//Óæå ÷òî-òî èçó÷àåì
$u->error = 'Òàê íå ïîéäåò, âû óæå ÷òî-òî èçó÷àåòå';
}else{
$tst = $u->testAction('`uid` = "'.$u->info['id'].'" AND `vars` = "read" AND `vals` = "'.$itm['item_id'].'" LIMIT 1',1);
if(isset($tst['id']))
{
$u->error = 'Âû óæå èçó÷èëè äàííîå çíàíèå';
}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 ) {
//5 òîì çíàíèé, íóæåí 1047
$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';
}
//$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")');
//if($ins)
//{
//$u->error = 'Âû íà÷àëè èçó÷àòü &quot;'.$itm['name'].'&quot;. Âðåìÿ èçó÷åíèÿ ñîñòàâèò '.$u->timeOut($st['timeRead']).'';
$u->error = 'Âû èçó÷èëè &quot;'.$itm['name'].'&quot;.';
$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{
// $u->error = '×òî-òî çäåñü íå òàê';
//}
}else{
$u->error = 'Òðåáóåò èçó÷åíèÿ ïðåäûäóùåãî òîìà';
}
unset($tom_iz);
}
}
}
?>