expl($pl['tr_date']); if(isset($d['tr_endq'])) { $i = 0; $e = explode(',', $d['tr_endq']); while($i < count($e)) { $qlst = mysql_fetch_array(mysql_query('SELECT `id`, `vals` FROM `actions` WHERE `uid` = "'.$uid.'" AND `vars` = "start_quest'.$e[$i].'" AND `vals` = "win" LIMIT 1')); if(!isset($qlst['id'])) { $r = 3; } $i++; } unset($qn, $qlst, $qlst2); } if(isset($d['tr_zdr'])) { $qlst = mysql_fetch_array(mysql_query('SELECT * FROM `actions` WHERE `uid` = "'.$uid.'" AND `vars` = "start_quest'.$pl['id'].'" AND `vals` != "go" ORDER BY `time` DESC LIMIT 1')); if($qlst['time']+($d['tr_zdr']*60*60)-time() > 0) { $r = 4; } unset($qlst); } if(isset($d['tr_tm1'])) { $d['tr_tm1'] = str_replace('d', date('d'), $d['tr_tm1']); $d['tr_tm1'] = str_replace('m', date('m'), $d['tr_tm1']); $d['tr_tm1'] = str_replace('y', date('y'), $d['tr_tm1']); $d['tr_tm2'] = str_replace('d', date('d'), $d['tr_tm2']); $d['tr_tm2'] = str_replace('m', date('m'), $d['tr_tm2']); $d['tr_tm2'] = str_replace('y', date('y'), $d['tr_tm2']); } if(isset($d['tr_raz'])) { $qlst = $this->testAction('SELECT `id` FROM `actions` WHERE `uid` = "'.$uid.'" AND `vars` = "start_quest'.$pl['id'].'" LIMIT '.$d['tr_raz'], 2); if($d['tr_raz'] > 0 && $d['tr_raz']-$qlst[0] <= 0) { $r = 5; } unset($qlst); } if(isset($d['tr_raz2'])) { $qlst = $this->testAction('SELECT `id` FROM `actions` WHERE `uid` = "'.$uid.'" AND `vars` = "start_quest'.$pl['id'].'" AND `vals` != "go" AND `vals` != "win" LIMIT '.$d['tr_raz2'], 2); if($d['tr_raz2']-$qlst[0] <= 0) { $r = 6; } unset($qlst); } return $r; } public function __clone() { trigger_error('Дублирование не допускается.', E_USER_ERROR); } public function startq($id, $val = NULL, $uid) { $pl = mysql_fetch_array(mysql_query('SELECT * FROM `quests` WHERE `delete` = "0" AND `id` = "'.mysql_real_escape_string($id).'" LIMIT 1')); if(isset($pl['id'])) { $tms = (time()+60*60*$pl['time']); $this->addAction(time(), 'start_quest'.$pl['id'], 'go', $uid, $tms); $this->error = 'Вы успешно получили задание "'.$pl['name'].'"'; } else { $this->error = 'Не удалось получить данное задание ...'; } } public function list_quest($pl, $u) { $r = ''; $t = ''; $nagr = ''; $tr = ''; $qlst = mysql_fetch_array(mysql_query('SELECT * FROM `actions` WHERE `uid` = "'.$u.'" AND `vars` = "start_quest'.$pl['id'].'" ORDER BY `time` DESC LIMIT 1')); $ds = $this->expl($pl['win_date']); if(isset($ds['add_cr'])) { $nagr .= 'Деньги : '.$ds['add_cr'].' кр. '; } if(isset($ds['add_point'])) { $nagr .= ' Репутация : '.$ds['add_point'].' ед. '; } if(isset($ds['add_exp'])) { $nagr .= ' Опыт : '.$ds['add_exp'].' ед. '; } $d = $this->expl($pl['act_date']); if(isset($d['heal'])) { $tr .= 'Вылечить '.$d['heal'].' игроков от травм.
'; } if(isset($d['tr_win_haot'])) { $tr .= 'Выйграть '.$d['tr_win_haot'].' хаотических поединков.
'; } if(isset($d['kill_clone'])) { $tr .= 'Выйграть '.$d['kill_clone'].' поединков против своего клона.
'; } // if(isset($d['tr_win'])) { // $tr .= 'Выйграть '.$d['tr_win'].' физических поединков против игроков.
'; // } if(isset($d['kill_bot'])) { $x = ''; $ex = explode(',', $d['kill_bot']); $i = 0; while($i < count($ex)) { $ex2 = explode('=', $ex[$i]); $bot2 = mysql_fetch_array(mysql_query('SELECT `id`, `login` FROM `users` WHERE `id` = "'.$ex2[0].'" LIMIT 1')); if(isset($bot2['id'])) { $x .= '    • '.$bot2['login'].' '.$ex2[1].'
'; } $i++; } if($x != '') { $x = trim($x, ', '); $tr .= 'Убить ботов:
'.$x.'
'; } } if($tr != '') { $ts = 'Требования :
'.$tr; } $za = ''; if($qlst['time']+($pl['heal']*60*60)-time() > 0) { $tms = $this->timeOut($qlst['time']+($pl['heal']*60*60)-time()); $za = 'Задержка еще : '.$tms.'
'; } $d = $this->expl($pl['tr_date']); $r .= '
'; $r .= '
я берусьЗадание "'.$pl['name'].'"
'; $r .= '
'.$pl['info'].'
Награда : '.$nagr.'
Время на выполнение: '.$pl['time'].' ч.
'.$ts.$za.'
Задание для ['.$pl['min_lvl'].'-'.$pl['max_lvl'].'] уровней, с задержкой '.$pl['heal'].' ч.
'; $r .= '
'; return $r; } public function info($pl, $uid) { $r = ''; $t = ''; $qst = mysql_fetch_array(mysql_query('SELECT * FROM `actions` WHERE `uid` = "'.$uid.'" AND `vars` = "start_quest'.$pl['id'].'" AND `vals` = "go" LIMIT 1')); $d = $this->expl($pl['tr_date']); if(isset($d['tr_endq'])) { $t .= 'Завершить квесты : '; $i = 0; $e = explode(',', $d['tr_endq']); while($i <= count($e)) { if($e[$i] > 0) { $qn = mysql_fetch_array(mysql_query('SELECT `name` FROM `quests` WHERE `id` = "'.$e[$i].'" LIMIT 1')); if(isset($qn['name'])) { $t .= '"'.$qn['name'].'", '; } } $i++; } $t = trim($t, ', '); $t .= '
'; unset($qn); } if(isset($d['tr_botitm'])) { $t .= 'Из ботов выпадают предметы :