507 lines
20 KiB
PHP
507 lines
20 KiB
PHP
<?php
|
|
if(!defined('GAME'))
|
|
{
|
|
die();
|
|
}
|
|
|
|
class Magic
|
|
{
|
|
|
|
public $youuse = 0;
|
|
|
|
//Îñëàáëåíèå ïîñëå áîÿ
|
|
public function oslablenie($uid)
|
|
{
|
|
$ins = mysql_query('INSERT INTO `eff_users` (`id_eff`,`uid`,`name`,`data`,`timeUse`) VALUES ("5","'.$uid.'","Îñëàáëåíèå ïîñëå áîÿ","add_m10=-1000|add_m11=-1000","'.time().'")');
|
|
if($ins)
|
|
{
|
|
return true;
|
|
}else{
|
|
return false;
|
|
}
|
|
}
|
|
|
|
//Èñïîëüçîâàíèå ïðåäìåòà
|
|
public function useItems($id)
|
|
{
|
|
global $u,$c,$code;
|
|
$itm = mysql_fetch_array(mysql_query('SELECT `im`.*,`iu`.* FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.`item_id`) WHERE `iu`.`uid` = "'.$u->info['id'].'" AND `iu`.`id` = "'.mysql_real_escape_string((int)$id).'" LIMIT 1'));
|
|
if(isset($itm['id']))
|
|
{
|
|
$st = $u->lookStats($itm['data']);
|
|
if(isset($st['usefromfile']) && $st['usefromfile']==1)
|
|
{
|
|
if(file_exists('_incl_data/class/magic/'.$itm['magic_inci'].'.php'))
|
|
{
|
|
require('_incl_data/class/magic/'.$itm['magic_inci'].'.php');
|
|
}else{
|
|
$u->error = '7Íå óäàëîñü èñïîëüçîâàòü ('.$itm['magic_inci'].')';
|
|
}
|
|
}elseif($itm['type']==30)
|
|
{
|
|
//Ýëèêñèðû
|
|
$goodUse = 0; $use = array();
|
|
if(isset($st['moment']))
|
|
{
|
|
//Ýëèêñèð èñïîëüçóåòñÿ ìîìåíòàëüíî (Âîññòàíîâëåíèå ÍÐ èëè ÌÐ)
|
|
if(isset($st['moment_hp']))
|
|
{
|
|
//Âîññòàíàâëèâàåì çäîðîâüå
|
|
if($u->stats['hpNow']<$u->stats['hpAll'])
|
|
{
|
|
$goodUse = 1;
|
|
$use['moment_hp'] = $st['moment_hp'];
|
|
|
|
if($u->stats['hpNow']+$use['moment_hp']>$u->stats['hpAll'])
|
|
{
|
|
$use['moment_hp'] = ceil($u->stats['hpAll']-$u->stats['hpNow']);
|
|
}
|
|
|
|
$u->error .= 'Âû âîññòàíîâèëè '.($use['moment_hp']).' HP.<br>';
|
|
}else{
|
|
$u->error = 'Âàøå çäîðîâüå è òàê ïîëíîñòüþ âîññòàíîâëåíî';
|
|
$goodUse = 0;
|
|
}
|
|
}
|
|
|
|
if(isset($st['moment_mp']))
|
|
{
|
|
//Âîññòàíàâëèâàåì çäîðîâüå
|
|
if($u->stats['mpNow']<$u->stats['mpAll'])
|
|
{
|
|
$goodUse = 1;
|
|
$use['moment_mp'] = $st['moment_mp'];
|
|
|
|
if($u->stats['mpNow']+$use['moment_mp']>$u->stats['mpAll'])
|
|
{
|
|
$use['moment_mp'] = ceil($u->stats['mpAll']-$u->stats['mpNow']);
|
|
}
|
|
|
|
$u->error .= 'Âû âîññòàíîâèëè '.($use['moment_mp']).' MP.<br>';
|
|
}else{
|
|
$u->error = 'Âàøà ìàííà è òàê ïîëíîñòüþ âîññòàíîâëåíà';
|
|
$goodUse = 0;
|
|
}
|
|
}
|
|
|
|
if($itm['iznosNOW']>=$itm['iznosMAX'])
|
|
{
|
|
$u->error = 'Ýëèêñèð áûë èñïîð÷åí...';
|
|
$goodUse = 0;
|
|
}
|
|
|
|
if(($u->info['align']==2 || $u->info['haos']>time()) && isset($st['nohaos']))
|
|
{
|
|
$goodUse = 0;
|
|
$u->error = 'Õàîñíèêè íå ìîãóò èñïîëüçîâàòü äàííûé ýëèêñèð';
|
|
}
|
|
|
|
//Çàíîñèì äàííûå â ÁÄ
|
|
if($goodUse==1)
|
|
{
|
|
$itm['iznosNOW']++;
|
|
$upd = mysql_query('UPDATE `items_users` SET `iznosNOW` = "'.$itm['iznosNOW'].'" WHERE `id` = "'.$itm['id'].'" AND `uid` = "'.$u->info['id'].'" LIMIT 1');
|
|
if($upd)
|
|
{
|
|
$u->stats['hpNow'] += $use['moment_hp'];
|
|
$u->info['hpNow'] += $use['moment_hp'];
|
|
mysql_query('UPDATE `stats` SET `hpNow` = "'.$u->info['hpNow'].'" WHERE `id` = "'.$u->info['id'].'" LIMIT 1');
|
|
$u->addDelo(1,$u->info['id'],'"<font color="maroon">System.inventory</font>": Ïåðñîíàæ èñïîëüçîâàë ýëèêñèð "'.$itm['name'].'" (+'.$use['moment_hp'].' HP) [itm:'.$itm['id'].'].',time(),$u->info['city'],'System.inventory',0,0);
|
|
$this->youuse++;
|
|
$u->error = 'Âû óñïåøíî èñïîëüçîâàëè ýëèêñèð "'.$itm['name'].'"<br>'.$u->error.'';
|
|
}else{
|
|
$u->error = 'Íå óäàëîñü èñïîëüçîâàòü ýëèêñèð...';
|
|
}
|
|
}
|
|
}else{
|
|
//Ýëèêñèðû ñ ïðîäîëæèòåëüíûì ýôôåêòîì
|
|
$goodUse = 1;
|
|
if(($u->info['align']==2 || $u->info['haos']>time()) && isset($st['nohaos']))
|
|
{
|
|
$goodUse = 0;
|
|
$u->error = 'Õàîñíèêè íå ìîãóò èñïîëüçîâàòü äàííûé ýëèêñèð';
|
|
}
|
|
if($goodUse==1)
|
|
{
|
|
$upd1 = 1;
|
|
$upd2 = 1;
|
|
//äîáàâëÿåì ýôôåêò ïåðñîíàæó
|
|
if(isset($st['onlyOne']))
|
|
{
|
|
//óáèðàåì ïðîøëûå ýôôåêòû
|
|
$goodUse = 0;
|
|
$upd1 = mysql_query('UPDATE `eff_users` SET `delete` = "'.time().'" WHERE `uid` = "'.$u->info['id'].'" AND `delete` = "0" AND `id_eff` = "'.$itm['magic_inc'].'"');
|
|
if($upd1)
|
|
{
|
|
$goodUse = 1;
|
|
}
|
|
}
|
|
if(isset($st['oneType']))
|
|
{
|
|
//óáèðàåì ïðîøëûå ýôôåêòû
|
|
$goodUse = 0;
|
|
$upd2 = mysql_query('UPDATE `eff_users` SET `delete` = "'.time().'" WHERE `uid` = "'.$u->info['id'].'" AND `delete` = "0" AND `overType` = "'.$itm['overType'].'"');
|
|
if($upd1)
|
|
{
|
|
$goodUse = 1;
|
|
}
|
|
}
|
|
if($goodUse == 1)
|
|
{
|
|
$us = $this->add_eff($u->info['id'],$itm['magic_inc']);
|
|
if($us[0]==1)
|
|
{
|
|
$itm['iznosNOW']++;
|
|
mysql_query('UPDATE `items_users` SET `iznosNOW` = "'.$itm['iznosNOW'].'" WHERE `id` = "'.$itm['id'].'" AND `uid` = "'.$u->info['id'].'" LIMIT 1');
|
|
$u->addDelo(1,$u->info['id'],'"<font color="maroon">System.inventory</font>": Ïåðñîíàæ èñïîëüçîâàë ýëèêñèð "'.$itm['name'].'" ('.$us[1].') [itm:'.$itm['id'].'].',time(),$u->info['city'],'System.inventory',0,0);
|
|
$this->youuse++;
|
|
$u->error = 'Âû óñïåøíî èñïîëüçîâàëè ýëèêñèð "'.$itm['name'].'"<br>'.$us[1].'';
|
|
}else{
|
|
$u->error = '6Íå óäàëîñü èñïîëüçîâàòü "'.$itm['name'].'"';
|
|
}
|
|
}else{
|
|
$u->error = '5Íå óäàëîñü èñïîëüçîâàòü "'.$itm['name'].'"';
|
|
}
|
|
}
|
|
}
|
|
//---------------
|
|
}elseif($itm['type']==29)
|
|
{
|
|
//èñïîëüçóåì çàêëÿòèå
|
|
$st = $u->lookStats($itm['data']);
|
|
$jl = $_GET['login'];
|
|
$_GET['login'] = urlencode($_GET['login']);
|
|
//èñïîëüçóåì íà ïåðñîíàæà (âñå êðîìå ñåáÿ)
|
|
$_GET['login'] = str_replace('%',' ',$_GET['login']);
|
|
$_GET['login'] = str_replace('25','',$_GET['login']);
|
|
$jl = str_replace('%',' ',$jl);
|
|
$jl = str_replace('25','',$jl);
|
|
if(isset($st['useOnLogin']) && $st['useOnLogin']==1)
|
|
{
|
|
$usr = mysql_fetch_array(mysql_query('SELECT `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']))
|
|
{
|
|
if($itm['iznosNOW']>=$itm['iznosMAX'])
|
|
{
|
|
$u->error = 'Ñâèòîê áûë èñïîë÷åí...';
|
|
}elseif($itm['magic_inci']=='snowball')
|
|
{
|
|
if($usr['id']==$u->info['id'])
|
|
{
|
|
$u->error = 'Íåëüçÿ êèäàòüñÿ â ñàìîãî ñåáÿ';
|
|
}elseif($usr['online']<time()-120)
|
|
{
|
|
$u->error = 'Ïåðñîíàæ íàõîäèòñÿ â ðåàëüíîì ìèðå ;)';
|
|
}elseif($usr['room']!=$u->info['room'])
|
|
{
|
|
$u->error = 'Ïåðñîíàæ íàõîäèòñÿ â äðóãîé êîìíàòå ['.$usr['room'].' '.$u->info['room'].']';
|
|
}elseif($usr['admin']>0 && $u->info['admin']==0)
|
|
{
|
|
$u->error = 'Íåëüçÿ êèäàòüñÿ â Àíãåëîâ';
|
|
}elseif($usr['battle']>0 && $u->info['battle']!=$usr['battle'])
|
|
{
|
|
$u->error = 'Ïåðñîíàæ íàõîäèòñÿ â áîþ';
|
|
}else{
|
|
$usr['hpNow'] -= 1000;
|
|
if($usr['hpNow']<0)
|
|
{
|
|
$usr['hpNow'] = 0;
|
|
}
|
|
$upd = mysql_query('UPDATE `stats` SET `hpNow` = "'.$usr['hpNow'].'" WHERE `id` = "'.$usr['id'].'" LIMIT 1');
|
|
if($upd)
|
|
{
|
|
$sx = 'ûé'; $sx2 = '';
|
|
if($u->info['sex']==1)
|
|
{
|
|
$sx = 'àÿ'; $sx2 = 'à';
|
|
}
|
|
$itm['iznosNOW']++;
|
|
mysql_query('UPDATE `items_users` SET `iznosNOW` = "'.$itm['iznosNOW'].'" WHERE `id` = "'.$itm['id'].'" AND `uid` = "'.$u->info['id'].'" LIMIT 1');
|
|
$rtxt = '[img[items/snowball1.gif]] Õèòð'.$sx.' "'.$u->info['login'].'" áðîñèë'.$sx2.' êóñîê ñíåãà â "'.$usr['login'].'". <font color=red><b>-1000</b></font> ['.$usr['hpNow'].'/????]';
|
|
mysql_query("INSERT INTO `chat` (`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`,`typeTime`) VALUES ('".$u->info['city']."','".$u->info['room']."','','','".$rtxt."','".time()."','11','0','1')");
|
|
unset($sx,$sx2);
|
|
}else{
|
|
$u->error = 'Íå óäàëîñü êèíóòü ñíåæîê...';
|
|
}
|
|
}
|
|
}elseif($itm['magic_inci']=='atack')
|
|
{
|
|
//çàêëÿòüå íàïàäåíèÿ
|
|
$usta = $u->getStats($usr['id'],0); // ñòàòû öåëè
|
|
$minHp = $usta['hpAll']/100*33; // ìèíèìàëüíûé çàïàñ çäîðîâüÿ öåëè ïðè êîòîðîì ìîæíî íàïàñòü
|
|
|
|
if($u->info['dnow']!=$usr['dnow']){
|
|
$u->error = 'Ïåðñîíàæ íàõîäèòñÿ â äðóãîé êîìíàòå [ïåùåðà]';
|
|
}elseif($u->info['battle']>0){
|
|
$u->error = 'Âû óæå íàõîäèòåñü â áîþ';
|
|
}elseif($usr['id']==$u->info['id']){
|
|
$u->error = 'Íåëüçÿ íàïàäàòü íà ñàìîãî ñåáÿ';
|
|
}elseif($usr['online']<time()-120){
|
|
$u->error = 'Ïåðñîíàæ íàõîäèòñÿ â ðåàëüíîì ìèðå';
|
|
}elseif($usr['room']!=$u->info['room']){
|
|
$u->error = 'Ïåðñîíàæ íàõîäèòñÿ â äðóãîé êîìíàòå ['.$usr['room'].' '.$u->info['room'].']';
|
|
}elseif($usr['admin']>0 && $u->info['admin']==0){
|
|
$u->error = 'Íåëüçÿ íàïàäàòü íà Àíãåëîâ';
|
|
}elseif($minHp>$usta['hpNow']){
|
|
//ìàëî õï
|
|
$u->error = 'Ïåðñîíàæ èìååò ñëèøêîì ìàëûé óðîâåíü æèçíåé.';
|
|
}else{
|
|
$atc = $this->atackUser($u->info['id'],$usr['id'],$usr['team'],$usr['battle']);
|
|
if($atc==1 && $u->info['align'] != 2){
|
|
//îòïðàâëÿåì ñèñòåìêó â ÷àò
|
|
$sx = '';
|
|
if($u->info['sex']==1){
|
|
$sx = 'à';
|
|
}
|
|
$itm['iznosNOW']++;
|
|
mysql_query('UPDATE `items_users` SET `iznosNOW` = "'.$itm['iznosNOW'].'" WHERE `id` = "'.$itm['id'].'" AND `uid` = "'.$u->info['id'].'" LIMIT 1');
|
|
$rtxt = '[img[items/pal_button8.gif]] "'.$u->info['login'].'" èñïîëüçîâàë'.$sx.' ìàãèþ íàïàäåíèÿ íà ïåðñîíàæà "'.$usr['login'].'".';
|
|
mysql_query("INSERT INTO `chat` (`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`,`typeTime`) VALUES ('".$u->info['city']."','".$u->info['room']."','','','".$rtxt."','".time()."','11','0','1')");
|
|
//íàïàëè, îáíîâëÿåì ýêðàí
|
|
die('<script>top.frames[\'main\'].location = "main.php";</script>');
|
|
}else{
|
|
$u->error = 'Íå óäàëîñü íàïàñòü íà ïåðñîíàæà...';
|
|
}
|
|
}
|
|
}else{
|
|
//ïðîñòî èñïîëüçóåì íà ïåðñîíàæà
|
|
if($u->info['dnow']!=$usr['dnow'])
|
|
{
|
|
$u->error = 'Ïåðñîíàæ íàõîäèòñÿ â äðóãîé êîìíàòå [ïåùåðà]';
|
|
}elseif($usr['id']==$u->info['id'] && isset($st['useOnlyUser']))
|
|
{
|
|
$u->error = 'Íåëüçÿ èñïîëüçîâàòü ýòî çàêëÿòèå íà ñàìîãî ñåáÿ';
|
|
}elseif($usr['online']<time()-120)
|
|
{
|
|
$u->error = 'Ïåðñîíàæ íàõîäèòñÿ â ðåàëüíîì ìèðå ;)';
|
|
}elseif($usr['room']!=$u->info['room'])
|
|
{
|
|
$u->error = 'Ïåðñîíàæ íàõîäèòñÿ â äðóãîé êîìíàòå ['.$usr['room'].' '.$u->info['room'].']';
|
|
}elseif($usr['admin']>0 && $u->info['admin']==0 && isset($st['useNoAdmin']))
|
|
{
|
|
$u->error = 'Íåëüçÿ èñïîëüçîâàòü äàííîå çàêëÿòèå íà Àíãåëîâ';
|
|
}elseif($usr['battle']>0 && $u->info['battle']!=$usr['battle'])
|
|
{
|
|
$u->error = 'Ïåðñîíàæ íàõîäèòñÿ â áîþ';
|
|
}elseif(($u->info['align']==2 || $u->info['haos']>time()) && isset($st['nohaos']))
|
|
{
|
|
$u->error = 'Õàîñíèêè íå ìîãóò èñïîëüçîâàòü äàííîå çàêëÿòèå';
|
|
}else{
|
|
//äîáàâëÿåì ýôôåêò ïåðñîíàæó
|
|
$goodUse = 1;
|
|
if(isset($st['onlyOne']))
|
|
{
|
|
//óáèðàåì ïðîøëûå ýôôåêòû
|
|
$goodUse = 0;
|
|
$upd1 = mysql_query('UPDATE `eff_users` SET `delete` = "'.time().'" WHERE `uid` = "'.$usr['id'].'" AND `delete` = "0" AND `id_eff` = "'.$itm['magic_inc'].'"');
|
|
if($upd1)
|
|
{
|
|
$goodUse = 1;
|
|
}
|
|
}
|
|
if(isset($st['oneType']))
|
|
{
|
|
//óáèðàåì ïðîøëûå ýôôåêòû
|
|
$goodUse = 0;
|
|
$upd2 = mysql_query('UPDATE `eff_users` SET `delete` = "'.time().'" WHERE `uid` = "'.$usr['id'].'" AND `delete` = "0" AND `overType` = "'.$itm['overType'].'"');
|
|
if($upd1)
|
|
{
|
|
$goodUse = 1;
|
|
}
|
|
}
|
|
if($goodUse == 1)
|
|
{
|
|
$us = $this->add_eff($usr['id'],$itm['magic_inc']);
|
|
if($us[0]==1)
|
|
{
|
|
$itm['iznosNOW']++;
|
|
mysql_query('UPDATE `items_users` SET `iznosNOW` = "'.$itm['iznosNOW'].'" WHERE `id` = "'.$itm['id'].'" AND `uid` = "'.$u->info['id'].'" LIMIT 1');
|
|
if($u->info['id']!=$usr['id'])
|
|
{
|
|
$u->addDelo(1,$u->info['id'],'"<font color="maroon">System.inventory</font>": Ïåðñîíàæ èñïîëüçîâàë çàêëèíàíèå "'.$itm['name'].'" ('.$us[1].') íà ïåðñîíàæà "'.$usr['login'].'" (id'.$usr['id'].') [itm:'.$itm['id'].'].',time(),$u->info['city'],'System.inventory',0,0);
|
|
$u->addDelo(1,$usr['id'],'"<font color="maroon">System.inventory</font>": Ïåðñîíàæ "'.$u->info['login'].'" (id'.$u->info['id'].') èñïîëüçîâàë çàêëèíàíèå "'.$itm['name'].'" ('.$us[1].') íà ïåðñîíàæà [itm:'.$itm['id'].'].',time(),$usr['city'],'System.inventory',0,0);
|
|
$u->error = 'Âû óñïåøíî èñïîëüçîâàëè çàêëèíàíèå "'.$itm['name'].'" íà ïåðñîíàæà "'.$usr['login'].'"<br>'.$us[1].'';
|
|
$rtxt = '[img[items/'.$itm['img'].']] "'.$u->info['login'].'" èñïîëüçîâàë'.$sx.' çàêëèíàíèå "'.$itm['name'].'" íà ïåðñîíàæà "'.$usr['login'].'".';
|
|
mysql_query("INSERT INTO `chat` (`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`,`typeTime`) VALUES ('".$u->info['city']."','".$u->info['room']."','','','".$rtxt."','".time()."','11','0','1')");
|
|
}else{
|
|
$u->addDelo(1,$u->info['id'],'"<font color="maroon">System.inventory</font>": Ïåðñîíàæ èñïîëüçîâàë çàêëèíàíèå "'.$itm['name'].'" ('.$us[1].') íà ïåðñîíàæà ñàìîãî ñåáÿ [itm:'.$itm['id'].'].',time(),$u->info['city'],'System.inventory',0,0);
|
|
$u->error = 'Âû óñïåøíî èñïîëüçîâàëè çàêëèíàíèå "'.$itm['name'].'" íà ñàìîãî ñåáÿ<br>'.$us[1].'';
|
|
$rtxt = '[img[items/'.$itm['img'].']] "'.$u->info['login'].'" èñïîëüçîâàë'.$sx.' çàêëèíàíèå "'.$itm['name'].'" íà ñåáÿ.';
|
|
mysql_query("INSERT INTO `chat` (`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`,`typeTime`) VALUES ('".$u->info['city']."','".$u->info['room']."','','','".$rtxt."','".time()."','11','0','1')");
|
|
}
|
|
$this->youuse++;
|
|
}else{
|
|
$u->error = '1Íå óäàëîñü èñïîëüçîâàòü "'.$itm['name'].'"';
|
|
}
|
|
}else{
|
|
$u->error = '2Íå óäàëîñü èñïîëüçîâàòü "'.$itm['name'].'"';
|
|
}
|
|
}
|
|
}
|
|
}else{
|
|
$u->error = 'Ïåðñîíàæ "'.$jl.'" íå íàéäåí â ýòîì ãîðîäå ('.$u->info['city'].')';
|
|
}
|
|
}elseif(isset($st['useOnItem']) && $st['useOnItem']==1)
|
|
{
|
|
//èñïîëüçóåì íà ïðåäìåò
|
|
|
|
}else{
|
|
//íà ñåáÿ
|
|
$goodUse = 1;
|
|
if(($u->info['align']==2 || $u->info['haos']>time()) && isset($st['nohaos']))
|
|
{
|
|
$goodUse = 0;
|
|
$u->error = 'Õàîñíèêè íå ìîãóò èñïîëüçîâàòü äàííîå çàêëÿòèå';
|
|
}
|
|
if($goodUse==1)
|
|
{
|
|
$upd1 = 1;
|
|
$upd2 = 1;
|
|
//äîáàâëÿåì ýôôåêò ïåðñîíàæó
|
|
if(isset($st['onlyOne']))
|
|
{
|
|
//óáèðàåì ïðîøëûå ýôôåêòû
|
|
$goodUse = 0;
|
|
$upd1 = mysql_query('UPDATE `eff_users` SET `delete` = "'.time().'" WHERE `uid` = "'.$u->info['id'].'" AND `delete` = "0" AND `id_eff` = "'.$itm['magic_inc'].'"');
|
|
if($upd1)
|
|
{
|
|
$goodUse = 1;
|
|
}
|
|
}
|
|
if(isset($st['oneType']))
|
|
{
|
|
//óáèðàåì ïðîøëûå ýôôåêòû
|
|
$goodUse = 0;
|
|
$upd2 = mysql_query('UPDATE `eff_users` SET `delete` = "'.time().'" WHERE `uid` = "'.$u->info['id'].'" AND `delete` = "0" AND `overType` = "'.$itm['overType'].'"');
|
|
if($upd1)
|
|
{
|
|
$goodUse = 1;
|
|
}
|
|
}
|
|
|
|
if($itm['magic_inci']=='add_animal')
|
|
{
|
|
if($u->info['animal']>0)
|
|
{
|
|
$u->error = 'Íå óäàëîñü èñïîëüçîâàòü "'.$itm['name'].'", ó Âàñ óæå åñòü çâåðü.';
|
|
}else{
|
|
$anm = array('type'=>1,'name'=>'','obraz'=>'','stats'=>'','sex'=>0);
|
|
if($anm['type']==1)
|
|
{
|
|
$anm['name'] = 'Êîò';
|
|
$anm['sex'] = 0;
|
|
$anm['obraz'] = array(1=>'20132.gif',2=>'21139.gif',3=>'20864.gif',4=>'21301.gif');
|
|
$anm['stats'] = 's1=2|s2=2|s3=2|s4=5|rinv=40|m9=5|m6=10';
|
|
}
|
|
$anm['obraz'] = $anm['obraz'][rand(1,count($anm['obraz']))];
|
|
$ins = mysql_query('INSERT INTO `users_animal` (`type`,`name`,`uid`,`obraz`,`stats`,`sex`) VALUES ("'.$anm['type'].'","'.$anm['name'].'","'.$u->info['id'].'","'.$anm['obraz'].'","'.$anm['stats'].'","'.$anm['sex'].'")');
|
|
if($ins)
|
|
{
|
|
|
|
$u->info['animal'] = mysql_insert_id();
|
|
mysql_query('UPDATE `users` SET `animal` = "'.$u->info['animal'].'" WHERE `id` = "'.$u->info['id'].'" LIMIT 1');
|
|
$u->error = 'Âû óñïåøíî èñïîëüçîâàëè "'.$itm['name'].'" è ïîìíèòå - "Ìû â îòâåòå çà òåõ, êîãî ïðèðó÷èëè".';
|
|
$itm['iznosNOW']++;
|
|
mysql_query('UPDATE `items_users` SET `iznosNOW` = "'.$itm['iznosNOW'].'" WHERE `id` = "'.$itm['id'].'" AND `uid` = "'.$u->info['id'].'" LIMIT 1');
|
|
$u->addDelo(1,$u->info['id'],'"<font color="maroon">System.inventory</font>": Ïåðñîíàæ èñïîëüçîâàë çàêëèíàíèå "'.$itm['name'].'" ('.$us[1].') [itm:'.$itm['id'].'].',time(),$u->info['city'],'System.inventory',0,0);
|
|
}else{
|
|
$u->error = 'Íå óäàëîñü èñïîëüçîâàòü "'.$itm['name'].'", ÷òî-òî çäåñü íå òàê ...';
|
|
}
|
|
}
|
|
}elseif($goodUse == 1)
|
|
{
|
|
$us = $this->add_eff($u->info['id'],$itm['magic_inc']);
|
|
if($us[0]==1)
|
|
{
|
|
$itm['iznosNOW']++;
|
|
mysql_query('UPDATE `items_users` SET `iznosNOW` = "'.$itm['iznosNOW'].'" WHERE `id` = "'.$itm['id'].'" AND `uid` = "'.$u->info['id'].'" LIMIT 1');
|
|
$u->addDelo(1,$u->info['id'],'"<font color="maroon">System.inventory</font>": Ïåðñîíàæ èñïîëüçîâàë çàêëèíàíèå "'.$itm['name'].'" ('.$us[1].') [itm:'.$itm['id'].'].',time(),$u->info['city'],'System.inventory',0,0);
|
|
$this->youuse++;
|
|
$u->error = 'Âû óñïåøíî èñïîëüçîâàëè çàêëèíàíèå "'.$itm['name'].'"<br>'.$us[1].'';
|
|
$rtxt = '[img[items/'.$itm['img'].']] "'.$u->info['login'].'" èñïîëüçîâàë'.$sx.' çàêëèíàíèå "'.$itm['name'].'" íà ñåáÿ.';
|
|
mysql_query("INSERT INTO `chat` (`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`,`typeTime`) VALUES ('".$u->info['city']."','".$u->info['room']."','','','".$rtxt."','".time()."','11','0','1')");
|
|
}else{
|
|
$u->error = '3Íå óäàëîñü èñïîëüçîâàòü "'.$itm['name'].'"';
|
|
}
|
|
}else{
|
|
$u->error = '4Íå óäàëîñü èñïîëüçîâàòü "'.$itm['name'].'"';
|
|
}
|
|
}
|
|
//------------------------------
|
|
}
|
|
}
|
|
}else{
|
|
$u->error = 'Ïðåäìåò íå íàéäåí â èíâåíòàðå';
|
|
}
|
|
}
|
|
|
|
|
|
public function add_eff($uid,$id)
|
|
{
|
|
$g = array(0=>0,1=>'');
|
|
$eff = mysql_fetch_array(mysql_query('SELECT * FROM `eff_main` WHERE `id2` = "'.$id.'" LIMIT 1'));
|
|
if(isset($eff['id2']))
|
|
{
|
|
$n = $eff['mname'];
|
|
$d = $eff['mdata'];
|
|
$ins = mysql_query('INSERT INTO `eff_users` (`overType`,`id_eff`,`uid`,`name`,`timeUse`,`data`) VALUES ("'.$eff['oneType'].'","'.$eff['id2'].'","'.$uid.'","'.$n.'","'.time().'","'.$d.'")');
|
|
if($ins)
|
|
{
|
|
$g[0] = 1;
|
|
$g[1] = '...';
|
|
}
|
|
}
|
|
return $g;
|
|
}
|
|
|
|
//ñîçäàåì íàïàäåíèå íà ïåðñîíàæà
|
|
public function atackUser($uid1,$uid2,$tm,$btl,$addExp = 0)
|
|
{
|
|
$good = 0;
|
|
if($btl==0)
|
|
{
|
|
//íàïàäàåì íà ïåðñîíàæà
|
|
$ins = mysql_query('INSERT INTO `battle` (`city`,`time_start`,`players`,`timeout`,`type`,`invis`,`noinc`,`travmChance`,`typeBattle`,`addExp`,`money`) VALUES (
|
|
"'.$u->info['city'].'",
|
|
"'.time().'",
|
|
"'.$u->info['login'].','.$usr['login'].'",
|
|
"180",
|
|
"0",
|
|
"0",
|
|
"0",
|
|
"50",
|
|
"9",
|
|
"'.$addExp.'",
|
|
"0")');
|
|
if($ins)
|
|
{
|
|
$btl_id = mysql_insert_id();
|
|
$upd2 = mysql_query('UPDATE `users` SET `battle`="'.$btl_id.'" WHERE `id` = "'.$uid1.'" OR `id` = "'.$uid2.'" LIMIT 2');
|
|
mysql_query('UPDATE `stats` SET `team`="1",`zv` = "0" WHERE `id` = "'.$uid1.'" LIMIT 1');
|
|
mysql_query('UPDATE `stats` SET `team`="2",`zv` = "0" WHERE `id` = "'.$uid2.'" LIMIT 1');
|
|
$good = 1;
|
|
}
|
|
}else{
|
|
//âìåøèâàåìñÿ â áîé
|
|
$upd = mysql_query('UPDATE `users` SET `battle`="'.$btl.'" WHERE `id` = "'.$uid1.'" LIMIT 1');
|
|
if($upd)
|
|
{
|
|
$ltm = array(1=>2,2=>1);
|
|
mysql_query('UPDATE `stats` SET `team`="'.$ltm[$tm].'" WHERE `id` = "'.$uid1.'" LIMIT 1');
|
|
$good = 1;
|
|
}
|
|
}
|
|
return $good;
|
|
}
|
|
|
|
//Íàïàäåíèå íà öåíòðàëüíîé ïëîùàäè
|
|
public function magicCentralAttack()
|
|
{
|
|
global $c,$code,$u,$re;
|
|
|
|
}
|
|
}
|
|
|
|
$magic = new Magic;
|
|
|
|
?>
|