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

45 lines
2.7 KiB
PHP

<?
if(!defined('GAME'))
{
die();
}
if( $itm['magic_inci'] == 'chains' && $itm['iznosNOW'] < $itm['iznosMAX']) {
$usr = mysql_fetch_array(mysql_query('SELECT `st`.`x`,`st`.`y`,`st`.`timeGo`,`st`.`clone`,`u`.`bot_id`,`u`.`type_pers`,`u`.`inTurnir`,`st`.`zv`,`st`.`bot`,`st`.`hpNow`,`u`.`login`,`st`.`dnow`,`u`.`id`,`u`.`align`,`u`.`admin`,`u`.`clan`,`u`.`level`,`u`.`room`,`u`.`online`,`u`.`battle`,`st`.`team` FROM `users` AS `u` LEFT JOIN `stats` AS `st` ON (`u`.`id` = `st`.`id`) WHERE `u`.`city` = "'.$u->info['city'].'" AND (`u`.`login`="'.mysql_real_escape_string($_GET['login']).'" OR `u`.`login`="'.mysql_real_escape_string($jl).'") LIMIT 1'));
if(isset($usr['id']) && $usr['online'] > time()-520 ) {
//Ïóòû íà 1-10 ìèí
if( $u->info['room'] != $usr['room'] ) {
$u->error = 'Ïåðñîíàæ íàõîäèòñÿ â äðóãîé êîìíàòå';
}else{
if( $u->info['room'] >= 362 && $u->info['room'] <= 366 && ( $u->info['x'] != $usr['x'] || $u->info['y'] != $usr['y'] ) ) {
$u->error = 'Ïåðñîíàæ íàõîäèòñÿ â äðóãîé êîìíàòå';
}elseif( $usr['timeGo'] > time()+120 ) {
$u->error = 'Ïåðñîíàæ &quot;'.$usr['login'].'&quot; óæå îáåçäâèæåí';
}else{
$rmin = rand(1,10);
if( $usr['timeGo'] < time() ) {
$usr['timeGo'] = time();
}
$usr['timeGo'] += $rmin*60;
$putu = mysql_fetch_array(mysql_query('SELECT * FROM `eff_users` WHERE `img2` = "chains.gif" AND `delete` = "0" AND `uid` = "'.$usr['id'].'" LIMIT 1'));
if(!isset($putu['id'])) {
mysql_query('INSERT INTO `eff_users` (`user_use`,`id_eff`,`uid`,`name`,`data`,`overType`,`timeUse`,`img2`) VALUES (
"'.$u->info['login'].'","2","'.$usr['id'].'","Ïóòû","puti='.$usr['timeGo'].'","1","'.$usr['timeGo'].'","chains.gif"
) ');
}else{
mysql_query('UPDATE `eff_users` SET `timeUse` = "'.$usr['timeGo'].'" WHERE `id` = "'.$putu['id'].'" LIMIT 1');
}
mysql_query('UPDATE `items_users` SET `iznosNOW` = `iznosNOW` + 1 WHERE `id` = '.$itm['id'].' LIMIT 1');
mysql_query('UPDATE `stats` SET `timeGo` = "'.$usr['timeGo'].'",`timeGoL` = "'.$usr['timeGo'].'" WHERE `id` = "'.$usr['id'].'" LIMIT 1');
if( $u->info['id'] != $usr['id'] ) {
$rtxt = '[img[items/chains.gif]] Ïåðñîíàæ &quot;'.$u->info['login'].'&quot; èñïîëüçîâàë &quot;'.$itm['name'].'&quot; íà &quot;'.$usr['login'].'&quot; è îáåæäâèæèë åùå íà '.$rmin.' ìèí.';
mysql_query("INSERT INTO `chat` (`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`,`typeTime`,`new`) VALUES ('".$u->info['city']."','".$u->info['room']."','','','".$rtxt."','".time()."','6','0','1','1')");
}
$u->error = 'Âû óñïåøíî èñïîëüçîâàëè &quot;'.$itm['name'].'&quot; íà '.$usr['login'].', íà '.$rmin.' ìèí.';
}
}
}else{
$u->error = 'Ïåðñîíàæ íå íàéäåí â ýòîì ãîðîäå';
}
}
?>