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

84 lines
3.3 KiB
PHP

<?
if(!defined('GAME'))
{
die();
}
if($u->info['admin']>0 || ($u->info['align']>=3 && $u->info['align']<4))
{
$uu = mysql_fetch_array(mysql_query('SELECT * FROM `users` WHERE `login` = "'.mysql_real_escape_string($_POST['logingo']).'" LIMIT 1'));
$ust = $u->getStats($uu['id'],0);
if(isset($uu['id']))
{
if($uu['id'] == $u->info['id'])
{
$uer = 'Âû íå ìîæåòå êóñàòü ñàìîãî ñåáÿ';
}elseif($u->info['battle']>0)
{
$uer = 'Âû íå ìîæåòå êóñàòü â áîþ';
}elseif($ust['hpNow']<($ust['hpAll']/100*15))
{
$uer = 'Âû íå ìîæåòå óêóñèòü ýòîãî ïåðñîíàæà, æåðòâà ñëèøêîì ñëàáà';
}elseif($uu['level']>$u->info['level'])
{
$uer = 'Âû íå ìîæåòå êóñàòü ïåðñîíàæåé ñòàðøå âàñ ïî óðîâíþ';
}elseif(date('H',time())>6 && date('H',time())<21 && $u->info['admin']==0)
{
$uer = 'Âàìïèðû íå ìîãóò êóñàòüñÿ äíåì';
}elseif($u->stats['hpNow'] >= ($u->stats['hpAll']/100*67) && $u->info['admin']==0)
{
$uer = 'Âû íå íóæíàåòåñü â ýòîì, âàøå çäîðîâüå âîññòàíîâèòñÿ ñàìî ...';
}elseif(floor($uu['align'])==3 && $u->info['admin']==0)
{
$uer = 'Âû íå ìîæåòå êóñàòü òåìíûõ';
}elseif($uu['online']<time()-120)
{
$uer = 'Ïåðñîíàæ ñåé÷àñ îôôëàéí';
}elseif($uu['room']!=$u->info['room'])
{
$uer = 'Âû äîëæíû íàõîäèòñÿ â îäíîé ëîêàöèè ñ æåðòâîé';
}elseif($uu['battle']>0)
{
$uer = 'Ïåðñîíàæ íàõîäèòñÿ â áîþ';
}else{
$sx = '';
if($u->info['sex']==1)
{
$sx = 'à';
}
$itm1 = mysql_fetch_array(mysql_query('SELECT * FROM `items_users` WHERE `uid` = "'.$uu['id'].'" AND `delete` = 0 AND `inShop` = 0 AND `inTransfer` = 0 AND `iznosNow` >= 1 AND `item_id` = 1164 LIMIT 1'));
if(isset($itm1['id']))
{
$uer = 'Íå óäàëîñü âûïèòü ýíåðãèþ "'.$uu['login'].'", ó '.$uu.' áûë ïðè ñåáå &quot;'.$itm1['name'].'&quot;.<br>';
}else{
$itm2 = mysql_fetch_array(mysql_query('SELECT * FROM `items_users` WHERE `uid` = "'.$uu['id'].'" AND `delete` = 0 AND `inShop` = 0 AND `inTransfer` = 0 AND `iznosNow` >= 1 AND `item_id` = 1163 LIMIT 1'));
if(isset($itm2['id']))
{
$sx = 'íåãî';
if($uu['sex']==1)
{
$sx = 'íå¸';
}
$uer = 'Íå óäàëîñü âûïèòü ýíåðãèþ "'.$uu['login'].'", ó '.$uu.' áûë ïðè ñåáå &quot;'.$itm2['name'].'&quot;.<br>';
$rtxt = '[img[items/chesnok2.gif]] Âàìïèð &quot;'.$u->info['login'].'&quot; íåóäà÷íî óêóñèë'.$sx.' ò.ê. ó &quot;'.$uu['login'].'&quot; áûë ïðè ñåáå ÷åñíîê';
}else{
$rtxt = '[img[items/vampir.gif]] Âàìïèð &quot;'.$u->info['login'].'&quot; óêóñèë'.$sx.' è âûïèë'.$sx.' âñþ æèçíåííóþ ýíåðãèþ ïåðñîíàæà &quot;'.$uu['login'].'&quot;';
$u->stats['hpNow'] += $ust['hpNow'];
if($u->stats['hpNow']>$u->stats['hpAll'])
{
$u->stats['hpNow'] = $u->stats['hpAll'];
}
mysql_query('UPDATE `stats` SET `hpNow` = "'.$u->stats['hpAll'].'" WHERE `id` = "'.$u->info['id'].'" LIMIT 1');
mysql_query('UPDATE `stats` SET `hpNow` = "0" WHERE `id` = "'.$uu['id'].'" LIMIT 1');
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')");
$uer = 'Âû óñïåøíî âûïèëè âñþ êðîâü ó ïåðñîíàæà "'.$uu['login'].'".<br>';
}
}
unset($itm1,$itm2);
}
}else{
$uer = 'Ïåðñîíàæ íå íàéäåí â ýòîì ãîðîäå';
}
}else{
$uer = 'Ó Âàñ íåò ïðàâ íà èñïîëüçîâàíèå äàííîãî íàâûêà';
}
?>