2023-01-28 02:24:37 +00:00
< ? php
//Феерверк
2023-08-14 15:15:05 +00:00
use Helper\Conversion ;
2023-04-15 22:54:07 +00:00
2023-01-28 02:24:37 +00:00
if ( ! defined ( 'GAME' )) {
die ();
2022-06-06 21:30:34 +00:00
}
2023-01-28 02:24:37 +00:00
if ( $itm [ 'magic_inci' ] != 'feerverks' ) {
return ;
}
if ( $u -> room [ 'id' ] != '9' ) {
$u -> error = 'Вы не на Центральной Площади' ;
} elseif ( isset ( $lif [ 'id' ])) {
$u -> error = 'Запускать феерверки возможно не чаще одного раза в 10 сек.' ;
} else {
$chat = new Chat ();
$cmsg = new ChatMessage ();
$cmsg -> setCity ( $u -> info [ 'city' ]);
$cmsg -> setRoom ( $u -> info [ 'room' ]);
$cmsg -> setType ( 6 );
$cmsg -> setTypeTime ( 2 );
2023-08-14 15:15:05 +00:00
$po = Conversion :: dataStringToArray ( $itm [ 'data' ]);
2023-01-28 02:24:37 +00:00
$fid = 'fw04' ;
if ( isset ( $po [ 'feerverk_eff' ])) {
$fid = $po [ 'feerverk_eff' ];
}
mysql_query (
2023-08-11 15:28:54 +00:00
'INSERT INTO `feerverks` (`room`,`uid`,`time`,`fid`) VALUES ("' . $u -> info [ 'room' ] . '","' . $u -> info [ 'id' ] . '","' . time () . '","' . $fid . '")'
2023-01-28 02:24:37 +00:00
);
//
$a = $u -> info [ 'sex' ] == 1 ? 'a' : '' ; //окончание рода М \Ж в словах
2022-06-06 21:30:34 +00:00
2023-01-28 02:24:37 +00:00
//
if ( $po [ 'feerverk_sound' ] == 1 ) {
$po [ 'feerverk_sound' ] = mt_rand ( 8 , 10 );
}
//
$cmsg -> setText ( " [img[items/ { $itm [ 'img' ] } ]] <b> { $u -> info [ 'login' ] } </b> запустил $a фейерверк! " );
$cmsg -> setFireworks ( $fid );
$chat -> sendMsg ( $cmsg );
//
if ( rand ( 0 , 100 ) < 10 ) {
// У персонажа легкая травма - "Ожог от фейерверка" еще 3 мин. 43 сек.
// 22.02.14 21:14 лосенка пострадала от фейерверка! :fingal:
$spf = mysql_query (
2023-08-11 15:28:54 +00:00
'SELECT `id`,`login`,`sex` FROM `users` WHERE `online` > "' . ( time () - 120 ) . '" AND `invis` = 0 AND `battle` = 0 AND `room` = "' . $u -> info [ 'room' ] . '" ORDER BY `online` DESC LIMIT 100'
2023-01-28 02:24:37 +00:00
);
$fusr = [];
while ( $plf = mysql_fetch_array ( $spf )) {
//Иммунитет от травм, либо травма
$nou = mysql_fetch_array (
mysql_query (
'SELECT `id` FROM `eff_users` WHERE ( `id_eff` = 4 OR `id_eff` = 263 ) AND `uid` = "' . $plf [ 'id' ] . '" AND `delete` = 0 LIMIT 1'
)
);
if ( ! isset ( $nou [ 'id' ])) {
$fusr [] = $plf ;
}
}
unset ( $spf , $plf , $nou );
$fusr = $fusr [ rand ( 0 , ( count ( $fusr ) - 1 ))];
if ( isset ( $fusr [ 'id' ])) {
//Пострадавший от фейерверка
$ins = mysql_query (
' INSERT INTO `eff_users` ( `overType` , `timeUse` , `hod` , `name` , `data` , `uid` , `id_eff` , `img2` , `timeAce` , `v1` ) VALUES (
0 ,
unix_timestamp (),
- 1 ,
" Ожог от фейерверка " ,
" add_s' . mt_rand(1, 3) . '=-' . mt_rand(1, 3) . '|add_s' . mt_rand(1, 3) . '=-' . mt_rand(1, 3) . ' " ,
" ' . $fusr['id'] . ' " ,
4 ,
" eff_travma1.gif " ,
300 ,
1 ) '
);
$a = $fusr [ 'sex' ] == 1 ? 'a' : '' ; //окончание рода М \Ж в словах
$cmsg -> setFireworks ( null );
$cmsg -> setText ( " [img[items/travma.gif]] <b> { $fusr [ 'login' ] } </b> пострадал $a от фейерверка! :fingal: " );
}
unset ( $fusr );
}
unset ( $lif , $po );
//
mysql_query ( 'UPDATE `items_users` SET `iznosNOW` = `iznosNOW` + 1 WHERE `id` = ' . $itm [ 'id' ] . ' LIMIT 1' );
//
$u -> error = 'Вы успешно запустили феерверк "' . $itm [ 'name' ] . '"!' ;
2022-06-06 21:30:34 +00:00
}