2023-11-02 13:57:39 +00:00
< ? php
namespace User ;
use Core\Config ;
use Core\Db ;
use Helper\Conversion ;
use User ;
/**
* Рисует коробочку персонажа с логином сверху .
*/
class InfoBox
{
private User $user ;
private array $info ;
private array $is ;
public function __construct ( User $user )
{
$this -> user = $user ;
$this -> info = $user -> info ;
$this -> is = $user -> is ;
}
public function getInfoPers ( $uid , $i1 , $sn = 0 , $ivv = 0 ) : array
{
global $code ;
$rt = [];
if ( $uid != $this -> info [ 'id' ]) {
$u = User :: getInfo ( $uid );
if ( $sn == 0 ) {
$sn = $this -> user -> getStats ( $uid , $i1 );
}
} else {
$u = $this -> info ;
if ( isset ( $this -> user -> stats [ 'hpAll' ])) {
$sn = $this -> user -> stats ;
} elseif ( $sn == 0 ) {
$sn = $this -> user -> getStats ( $uid , $i1 );
}
}
$tp_img = [
1 => 4 ,
2 => 5 ,
14 => 6 ,
3 => 7 ,
5 => 8 ,
7 => 9 ,
17 => 10 ,
16 => 11 ,
13 => 12 ,
10 => 13 ,
9 => 14 ,
8 => 15 ,
11 => 17 , //кольцо 2
12 => 18 , //кольцо 3
];
if ( isset ( $u [ 'id' ], $u [ 'stats' ])) {
$rt = [ 0 => '' , 1 => []];
//Характеристики от предметов и их изображение
$witm = [];
$witm [ 1 ] = '<img width="60" height="60" style="display:block;" title="Пустой слот шлем" src="' . Config :: img () . '/i/items/w/w9.gif">' ;
$witm [ 2 ] = '<img width="60" height="40" style="display:block;" title="Пустой слот наручи" src="' . Config :: img () . '/i/items/w/w13.gif">' ;
$witm [ 3 ] = '<img width="60" height="60" style="display:block;" title="Пустой слот оружие" src="' . Config :: img () . '/i/items/w/w3.gif">' ;
$witm [ 4 ] = '<img width="60" height="80" style="display:block;" title="Пустой слот броня" src="' . Config :: img () . '/i/items/w/w4.gif">' ;
$witm [ 7 ] = '<img width="60" height="40" style="display:block;" title="Пустой слот пояс" src="' . Config :: img () . '/i/items/w/w5.gif">' ;
$witm [ 8 ] = '<img width="60" height="20" style="display:block;" title="Пустой слот серьги" src="' . Config :: img () . '/i/items/w/w1.gif">' ;
$witm [ 9 ] = '<img width="60" height="20" style="display:block;" title="Пустой слот ожерелье" src="' . Config :: img () . '/i/items/w/w2.gif">' ;
$witm [ 10 ] = '<img width="20" height="20" style="display:block;" title="Пустой слот кольцо" src="' . Config :: img () . '/i/items/w/w6.gif">' ;
$witm [ 11 ] = '<img width="20" height="20" style="display:block;" title="Пустой слот кольцо" src="' . Config :: img () . '/i/items/w/w6.gif">' ;
$witm [ 12 ] = '<img width="20" height="20" style="display:block;" title="Пустой слот кольцо" src="' . Config :: img () . '/i/items/w/w6.gif">' ;
$witm [ 13 ] = '<img width="60" height="40" style="display:block;" title="Пустой слот перчатки" src="' . Config :: img () . '/i/items/w/w11.gif">' ;
$witm [ 14 ] = '<img width="60" height="60" style="display:block;" title="Пустой слот щит" src="' . Config :: img () . '/i/items/w/w10.gif">' ;
$witm [ 16 ] = '<img width="60" height="80" style="display:block;" title="Пустой слот поножи" src="' . Config :: img () . '/i/items/w/w19.gif">' ;
$witm [ 17 ] = '<img width="60" height="40" style="display:block;" title="Пустой слот обувь" src="' . Config :: img () . '/i/items/w/w12.gif">' ;
//40-52 слот под магию
$witm [ 53 ] = '<img width="40" height="20" style="display:block;" title="Пустой слот правый карман" src="' . Config :: img () . '/i/items/w/w15.gif">' ;
$witm [ 54 ] = '<img width="40" height="20" style="display:block;" title="Пустой слот левый карман" src="' . Config :: img () . '/i/items/w/w15.gif">' ;
$witm [ 55 ] = '<img width="40" height="20" style="display:block;" title="Пустой слот центральный карман" src="' . Config :: img () . '/i/items/w/w15.gif">' ;
$witm [ 56 ] = '<img width="40" height="20" style="display:block;" title="Пустой слот смена" src="' . Config :: img () . '/i/items/w/w20.gif">' ;
$witm [ 57 ] = '<img width="40" height="20" style="display:block;" title="Пустой слот смена" src="' . Config :: img () . '/i/items/w/w20.gif">' ;
$witm [ 58 ] = '<img width="40" height="20" style="display:block;" title="Пустой слот смена" src="' . Config :: img () . '/i/items/w/w20.gif">' ;
$wj = [ 1 => false , 2 => false , 4 => false , 5 => false , 6 => false ];
$cl = Db :: getRows ( ' select items_users . id , name , img , type , inRazdel , info , level , magic_inci , class , item_id , uid , data , inOdet , magic_inc , overType
from items_users left join items_main on items_main . id = item_id where inOdet > 0 and uid = ? ', [$u[' id ' ]]);
foreach ( $cl as $pl ) {
$td = Conversion :: dataStringToArray ( $pl [ 'data' ]);
if ( isset ( $td [ 'modif' ])) {
$pl [ 'name' ] = $pl [ 'name' ] . ' (мф)' ;
}
if ( isset ( $td [ 'upatack_lvl' ])) {
$pl [ 'name' ] = $pl [ 'name' ] . ' +' . $td [ 'upatack_lvl' ];
}
if ( isset ( $td [ 'mod_lvl' ])) {
$pl [ 'name' ] = $pl [ 'name' ] . ' [' . $td [ 'mod_lvl' ] . ']' ;
}
if ( $pl [ 'inOdet' ] == 1 || $pl [ 'inOdet' ] == 52 || ( $pl [ 'inOdet' ] >= 4 && $pl [ 'inOdet' ] <= 6 )) {
$wj [ $pl [ 'inOdet' ]] = $pl ;
}
$pl [ 'name' ] = $this -> nameItemMf ( $pl , $td );
$lvar = $this -> getInfoItemInfo ( $pl , $td );
if ( @ isset ( $sn [ 'items_img' ][ $tp_img [ $pl [ 'inOdet' ]]])) {
$uimg = 'rimg/r' . $sn [ 'items_img' ][ $tp_img [ $pl [ 'inOdet' ]]];
} else {
$uimg = 'i/items/' . $pl [ 'img' ];
}
$witm [ $pl [ 'inOdet' ]] = '<img style="display:block;" src="' . Config :: img () . '/' . $uimg . '" onMouseOver="top.hi(this,\'<center><strong>' . $pl [ 'name' ] . '</strong>' . $lvar . '</center>\',event,3,0,1,1,\'max-width:307px\')" onMouseOut="top.hic();" onMouseDown="top.hic();">' ;
if ( $i1 == 1 ) {
$witm [ $pl [ 'inOdet' ]] = '<a href="/item/' . $pl [ 'item_id' ] . '" target="_blank">' . $witm [ $pl [ 'inOdet' ]] . '</a>' ;
} else {
if ( $pl [ 'inOdet' ] >= 40 && $pl [ 'inOdet' ] <= 52 && ! isset ( $_GET [ 'inv' ])) {
$useUrl = '' ;
if ( $pl [ 'magic_inc' ] == '' ) {
$pl [ 'magic_inc' ] = $pl [ 'magic_inci' ];
}
if ( $pl [ 'magic_inc' ] && $pl [ 'type' ] == 30 ) {
//используем эликсир
$pldate = '<table border=\\\'0\\\' width=\\\'100%\\\' cellspacing=\\\'0\\\' cellpadding=\\\'5\\\'><tr><td rowspan=2 width=\\\'80\\\' valign=\\\'middle\\\'><div align=\\\'center\\\'><img src=\\\'' . Config :: img () . '/i/items/' . $pl [ 'img' ] . '\\\'></div></td><td valign=\\\'middle\\\' align=\\\'left\\\'>"<strong>' . $pl [ 'name' ] . '</strong>"<br>Использовать сейчас?</td></tr></table>' ;
$useUrl = 'top.useiteminv(\'' . ( 0 + $pl [ 'id' ]) . '\',\'' . $pl [ 'img' ] . '\',\'' . $pl [ 'img' ] . '\',1,\'' . $pldate . '\',\'' . ( 0 + $_GET [ 'otdel' ]) . '\');' ;
} elseif ( $pl [ 'magic_inc' ] && $pl [ 'type' ] == 29 ) {
//используем заклятие
//на персонажа
if ( isset ( $td [ 'useOnLogin' ])) {
$inv1 = '' ;
if ( isset ( $_GET [ 'inv' ])) {
$inv1 = 'inv=1&otdel=' . (( int ) $_GET [ 'otdel' ]) . '&' ;
}
$useUrl = 'top.useMagic(\'' . $pl [ 'name' ] . '\',' . ( 0 + $pl [ 'id' ]) . ',\'' . $pl [ 'img' ] . '\',1,\'main.php?' . $inv1 . 'use_pid=' . $pl [ 'id' ] . '&rnd=' . $code . '\');' ;
} else {
//просто использование (на селя, либо без указания предмета\логина)
$pldate = '<table border=\\\'0\\\' width=\\\'100%\\\' cellspacing=\\\'0\\\' cellpadding=\\\'5\\\'><tr><td rowspan=2 width=\\\'80\\\' valign=\\\'middle\\\'><div align=\\\'center\\\'><img src=\\\'' . Config :: img () . '/i/items/' . $pl [ 'img' ] . '\\\'></div></td><td valign=\\\'middle\\\' align=\\\'left\\\'>"<strong>' . $pl [ 'name' ] . '</strong>"<br>Использовать сейчас?</td></tr></table>' ;
$useUrl = 'top.useiteminv(\'' . ( 0 + $pl [ 'id' ]) . '\',\'' . $pl [ 'img' ] . '\',\'' . $pl [ 'img' ] . '\',1,\'' . $pldate . '\',\'' . ( 0 + $_GET [ 'otdel' ]) . '\');' ;
}
}
$witm [ $pl [ 'inOdet' ]] = '<a href="javascript:void(0);" onClick="' . $useUrl . '">' . $witm [ $pl [ 'inOdet' ]] . '</a>' ;
} elseif ( $pl [ 'item_id' ] == 998 && ! isset ( $_GET [ 'inv' ])) {
//варежки
$witm [ $pl [ 'inOdet' ]] = '<a href="main.php?use_snowball=' . $code . '">' . $witm [ $pl [ 'inOdet' ]] . '</a>' ;
} else {
$witm [ $pl [ 'inOdet' ]] = '<a href="main.php?otdel=' . $pl [ 'inRazdel' ] . '&inv=1&sid=' . $pl [ 'id' ] . '&rnd=' . $code . '">' . $witm [ $pl [ 'inOdet' ]] . '</a>' ;
}
}
}
//Шлем,Венок
$wj1i = '' ;
$br = '<div align=\\\'center\\\' style=\\\'margin:4px;\\\'><img src=\\\'' . Config :: img () . '/1x1.gif\\\' height=\\\'1\\\' width=\\\'111\\\' style=\\\'background-color:black;\\\'></div>' ;
if ( $wj [ 1 ]) {
if ( ! empty ( $wj [ 52 ])) {
$wj1i .= $br ;
}
$td = Conversion :: dataStringToArray ( $wj [ 1 ][ 'data' ]);
$wj [ 1 ][ 'name' ] = $this -> nameItemMf ( $wj [ 1 ], $td );
$wj1i .= '<strong>' . $wj [ 1 ][ 'name' ] . '</strong>' ;
$wj1i .= $this -> getInfoItemInfo ( $wj [ 1 ], $td );
}
if ( ! empty ( $wj [ 52 ])) {
$td = Conversion :: dataStringToArray ( $wj [ 52 ][ 'data' ]);
$wj [ 52 ][ 'name' ] = $this -> nameItemMf ( $wj [ 52 ], $td );
$wj1i = '<strong>' . $wj [ 52 ][ 'name' ] . '</strong>' . $wj1i ;
$wj1i .= $this -> getInfoItemInfo ( $wj [ 52 ], $td );
$wj [ 1 ][ 'img' ] = $wj [ 52 ][ 'img' ];
$wj [ 1 ][ 'id' ] = $wj [ 52 ][ 'id' ];
$wj [ 1 ][ 'inRazdel' ] = $wj [ 52 ][ 'inRazdel' ];
}
//Р у б а х а ,Броня,Плащ
$wj4i = '' ;
if ( $wj [ 6 ]) {
$td = Conversion :: dataStringToArray ( $wj [ 6 ][ 'data' ]);
$wj [ 6 ][ 'name' ] = $this -> nameItemMf ( $wj [ 6 ], $td );
$wj4i .= '<strong>' . $wj [ 6 ][ 'name' ] . '</strong>' ;
$wj4i .= $this -> getInfoItemInfo ( $wj [ 6 ], $td );
if ( $wj [ 5 ] || $wj [ 4 ]) {
$wj4i .= $br ;
}
}
if ( $wj [ 5 ]) {
$wj4idd = $wj [ 5 ][ 'item_id' ];
$td = Conversion :: dataStringToArray ( $wj [ 5 ][ 'data' ]);
$wj [ 5 ][ 'name' ] = $this -> nameItemMf ( $wj [ 5 ], $td );
$wj4i .= '<strong>' . $wj [ 5 ][ 'name' ] . '</strong>' ;
$wj4i .= $this -> getInfoItemInfo ( $wj [ 5 ], $td );
if ( $wj [ 4 ]) {
$wj4i .= $br ;
}
}
if ( $wj [ 4 ]) {
$td = [];
$td = Conversion :: dataStringToArray ( $wj [ 4 ][ 'data' ]);
$wj [ 4 ][ 'name' ] = $this -> nameItemMf ( $wj [ 4 ], $td );
$wj4i .= '<strong>' . $wj [ 4 ][ 'name' ] . '</strong>' ;
$wj4i .= $this -> getInfoItemInfo ( $wj [ 4 ], $td );
}
if ( $this -> info [ 'noplaw' ] == 1 && ! isset ( $_GET [ 'hide_plaw' ]) || ( $this -> info [ 'noplaw' ] == 0 && isset ( $_GET [ 'hide_plaw' ]))) {
if ( $wj [ 5 ]) {
$wj [ 4 ][ 'img' ] = $wj [ 5 ][ 'img' ];
$wj [ 4 ][ 'id' ] = $wj [ 5 ][ 'id' ];
$wj [ 4 ][ 'inRazdel' ] = $wj [ 5 ][ 'inRazdel' ];
}
} else {
if ( $wj [ 6 ]) {
$wj [ 4 ][ 'img' ] = $wj [ 6 ][ 'img' ];
$wj [ 4 ][ 'id' ] = $wj [ 6 ][ 'id' ];
$wj [ 4 ][ 'inRazdel' ] = $wj [ 6 ][ 'inRazdel' ];
} elseif ( $wj [ 5 ]) {
$wj [ 4 ][ 'img' ] = $wj [ 5 ][ 'img' ];
$wj [ 4 ][ 'id' ] = $wj [ 5 ][ 'id' ];
$wj [ 4 ][ 'inRazdel' ] = $wj [ 5 ][ 'inRazdel' ];
}
}
if ( $wj [ 1 ] || $wj [ 2 ]) {
if ( isset ( $sn [ 'items_img' ][ $tp_img [ 1 ]])) {
$uimg = 'rimg/r' . $sn [ 'items_img' ][ $tp_img [ 1 ]];
} else {
$uimg = 'i/items/' . $wj [ 1 ][ 'img' ];
}
$witm [ 1 ] = '<img style="display:block;" src="' . Config :: img () . '/' . $uimg . '" onMouseOver="top.hi(this,\'<center>' . $wj1i . '</center>\',event,3,1,1,1,\'\');" onMouseOut="top.hic();" onMouseDown="top.hic();">' ;
if ( $i1 == 1 ) {
$witm [ 1 ] = '<a href="/item/' . $wj [ 1 ][ 'item_id' ] . '" target="_blank">' . $witm [ 1 ] . '</a>' ;
} else {
$witm [ 1 ] = '<a href="main.php?otdel=' . $wj [ 1 ][ 'inRazdel' ] . '&inv=1&sid=' . $wj [ 1 ][ 'id' ] . '&rnd=' . $code . '">' . $witm [ 1 ] . '</a>' ;
}
}
if ( $wj [ 4 ] || $wj [ 5 ] || $wj [ 6 ]) {
if ( isset ( $sn [ 'items_img' ][ $tp_img [ 5 ]])) {
$uimg = 'rimg/r' . $sn [ 'items_img' ][ $tp_img [ 5 ]];
} else {
$uimg = 'i/items/' . $wj [ 4 ][ 'img' ];
}
$witm [ 4 ] = '<img style="display:block;" src="' . Config :: img () . '/' . $uimg . '" onMouseOver="top.hi(this,\'<center>' . $wj4i . '</center>\',event,3,1,1,1,\'\');" onMouseOut="top.hic();" onMouseDown="top.hic();">' ;
if ( $i1 == 1 ) {
if ( $wj4idd > 0 && isset ( $wj [ 4 ][ 'item_id' ])) {
$wj [ 4 ][ 'item_id' ] = $wj4idd ;
}
$witm [ 4 ] = '<a href="/item/' . $wj [ 4 ][ 'item_id' ] . '" target="_blank">' . $witm [ 4 ] . '</a>' ;
} else {
$witm [ 4 ] = '<a href="main.php?otdel=' . $wj [ 4 ][ 'inRazdel' ] . '&inv=1&sid=' . $wj [ 4 ][ 'id' ] . '&rnd=' . $code . '">' . $witm [ 4 ] . '</a>' ;
}
}
/*------------ ГЕНЕРИРУЕМ ИНФ. О ПЕРСОНАЖЕ ---------------*/
$nmmsgl1 = 0 ;
if ( $u [ 'align' ] >= 1 && $u [ 'align' ] < 2 ) {
$nmmsgl1 = 1 ;
} elseif ( $u [ 'align' ] >= 3 && $u [ 'align' ] < 4 ) {
$nmmsgl1 = 3 ;
} elseif ( $u [ 'align' ] >= 7 && $u [ 'align' ] < 8 ) {
$nmmsgl1 = 7 ;
} elseif ( $u [ 'align' ] >= 50 || $u [ 'admin' ] > 0 ) {
$nmmsgl1 = 60 ;
}
$anan = [
1 => 'cat' ,
2 => 'owl' ,
3 => 'wisp' ,
4 => 'demon' ,
5 => 'dog' ,
6 => 'pig' ,
7 => 'dragon' ,
];
$anan2 = [
1 => 'Кот' ,
2 => 'Сова' ,
3 => 'Светляк' ,
4 => 'Чертяка' ,
5 => 'Пёс' ,
6 => 'Свин' ,
7 => 'Дракон' ,
];
$anml = '' ;
if ( $u [ 'animal' ] > 0 ) {
$an = mysql_fetch_array (
mysql_query (
'SELECT `id`,`type`,`name`,`uid`,`delete`,`inBattle`,`eda`,`exp`,`obraz`,`stats`,`level`,`sex`,`levelUp`,`pet_in_cage`,`max_exp`,`priems`,`bonus` FROM `users_animal` WHERE `id` = "' . $u [ 'animal' ] . '" AND `pet_in_cage` = 0 AND `delete` = "0" LIMIT 1'
)
);
if ( isset ( $an [ 'id' ])) {
$petimg = mysql_fetch_array (
mysql_query (
'SELECT `id`,`img` FROM `obraz_pet` WHERE `uid` = "' . $u [ 'id' ] . '" AND `use` = 1 LIMIT 1'
)
);
if ( isset ( $petimg [ 'id' ])) {
$anml = '<img height="40" width="120" src="' . Config :: img () . '/pet/' . $petimg [ 'img' ] . '" onMouseOver="top.hi(this,\'<strong>' . $an [ 'name' ] . '</strong> <i>(' . $anan2 [ $an [ 'type' ]] . ')</i><br>Уровень: ' . $an [ 'level' ] . '\',event,2,1,1,1,\'\');" onMouseOut="top.hic();" onMouseDown="top.hic();">' ;
} else {
$anml = '<img height="40" width="120" src="' . Config :: img () . '/pet/' . $anan [ $an [ 'type' ]] . '.png" onMouseOver="top.hi(this,\'<strong>' . $an [ 'name' ] . '</strong><i>(' . $anan2 [ $an [ 'type' ]] . ')</i><br>Уровень: ' . $an [ 'level' ] . '\',event,2,1,1,1,\'\');" onMouseOut="top.hic();" onMouseDown="top.hic();">' ;
}
}
}
if ( isset ( $sn [ 'items_img' ][ 2 ])) {
$msl = '<img width="120" height="40" style="display:block" src="' . Config :: img () . '/rimg/r' . $sn [ 'items_img' ][ 2 ] . '">' ;
} else {
if ( $anml == '' ) {
$msl = '<img width="120" height="40" style="display:block" src="' . Config :: img () . '/i/slot_bottom' . $nmmsgl1 . '.gif">' ;
} else {
$msl = $anml ;
}
}
$oi = '' ;
if ( $i1 != 1 ) {
$oi = 'onMouseOver="top.hi(this,\'' . $u [ 'login' ] . ' (Перейти в "Инвентарь")\',event,3,1,1,1,\'\');" onMouseOut="top.hic();" onMouseDown="top.hic();"' ;
$msl = ' < table width = " 120 " border = " 0 " cellspacing = " 0 " cellpadding = " 0 " >
< tr >
< td width = " 40 " height = " 20 " > ' . $witm[53] . ' </ td >
< td width = " 40 " height = " 20 " > ' . $witm[55] . ' </ td >
< td width = " 40 " height = " 20 " > ' . $witm[54] . ' </ td >
</ tr >
< tr >
< td width = " 40 " height = " 20 " > ' . $witm[56] . ' </ td >
< td width = " 40 " height = " 20 " > ' . $witm[57] . ' </ td >
< td width = " 40 " height = " 20 " > ' . $witm[58] . ' </ td >
</ tr >
</ table > ' ;
}
$hpmp = '' ;
$eff = '' ;
//-------- генерируем эффекты
$efs = Db :: getRows ( ' select id , uid , img , img2 , timeUse , timeAce , info , name , data , type1 , see , actionTime
from eff_users left join eff_main on id_eff = id2 where uid = ? and deactiveTime < unix_timestamp () order by deactiveTime desc , timeUse ' ,
[ $u [ 'id' ]]);
foreach ( $efs as $e ) {
$esee = 1 ;
if ( $e [ 'see' ] == 0 && $i1 == 1 ) {
$esee = 0 ;
}
if ( $e [ 'see' ] == 2 && ( $u [ 'battle' ] != $this -> info [ 'battle' ] || $this -> info [ 'battle' ] == 0 )) {
$esee = 0 ;
}
if ( $e [ 'see' ] == 3 && $i1 == 0 ) {
$esee = 0 ;
}
if ( $e [ 'img' ] == '' ) {
$esee = 0 ;
}
if (( $e [ 'timeUse' ] + $e [ 'timeAce' ] + $e [ 'actionTime' ] >= time () || $e [ 'timeUse' ] == 77 ) && $esee == 1 ) {
$ei = '<strong><u>' . $e [ 'name' ] . '</u></strong>' ;
match ( true ) {
$e [ 'type1' ] > 0 && $e [ 'type1' ] < 7 => $ei .= ' (Эликсир)' ,
$e [ 'type1' ] > 6 && $e [ 'type1' ] < 11 || $e [ 'type1' ] == 16 => $ei .= ' (Заклятие)' ,
$e [ 'type1' ] == 14 => $ei .= ' (Прием)' ,
$e [ 'type1' ] == 15 => $ei .= ' (Изучение)' ,
$e [ 'type1' ] == 17 => $ei .= ' (Проклятие)' ,
$e [ 'type1' ] == 18 || $e [ 'type1' ] == 19 => $ei .= ' (Травма)' ,
$e [ 'type1' ] == 20 => $ei .= ' (Пристрастие)' ,
$e [ 'type1' ] == 22 => $ei .= ' (Ожидание)' ,
default => $ei .= ' (Эффект)' ,
};
$ei .= '<br>' ;
if ( $e [ 'type1' ] != 13 && $e [ 'timeUse' ] != 77 ) {
$ei .= 'Осталось: ' . Conversion :: secondsToTimeout ( $e [ 'timeUse' ] + $e [ 'timeAce' ] + $e [ 'actionTime' ] - time ());
}
//Действие эффекта
$tr = '' ;
$t = $this -> user -> items [ 'add' ];
$x = 0 ;
$ed = Conversion :: dataStringToArray ( $e [ 'data' ]);
while ( $x < count ( $t )) {
$n = $t [ $x ];
if ( isset ( $ed [ 'add_' . $n ], $this -> is [ $n ])) {
$z = '' ;
if ( $ed [ 'add_' . $n ] > 0 ) {
$z = '+' ;
}
$tr .= '<br>' . $this -> is [ $n ] . ': ' . $z . $ed [ 'add_' . $n ];
}
$x ++ ;
}
if ( $tr != '' ) {
$ei .= $tr ;
}
if ( $e [ 'info' ] != '' ) {
$ei .= '<br><i>Информация:</i><br>' . $e [ 'info' ];
}
if ( $e [ 'img2' ] != '' && $e [ 'img' ] == 'icon_none.gif' ) {
$e [ 'img' ] = $e [ 'img2' ];
}
if ( $e [ 'type1' ] == 18 || $e [ 'type1' ] == 19 ) {
$e [ 'img' ] = $e [ 'img2' ];
}
$eff .= '<img width="38" height="23" style="margin:1px;display:block;float:left;" src="' . Config :: img () . '/i/eff/' . $e [ 'img' ] . '"onMouseOver="top.hi(this,\'' . $ei . '\',event,0,1,1,1,\'\');" onMouseOut="top.hic(event);" onMouseDown="top.hic(event);" >' ;
} elseif ( $e [ 'timeUse' ] + $e [ 'timeAce' ] + $e [ 'actionTime' ] < time () && $e [ 'timeUse' ] != 77 ) {
//удаляем эффект
$ed = Conversion :: dataStringToArray ( $e [ 'data' ]);
if ( ! isset ( $ed [ 'finish_file' ]) || $this -> info [ 'id' ] == $e [ 'uid' ]) {
$this -> user -> endEffect ( $e [ 'id' ], $u );
}
}
}
//здоровье
$hptop = 0 ;
$lh = [ 0 => 'hp_none' , 1 => 1 ];
$lh [ 1 ] = floor (( 0 + $sn [ 'hpNow' ]) / ( 0 + $sn [ 'hpAll' ]) * 120 );
if ( $lh [ 1 ] > 0 ) {
$lh [ 0 ] = 'hp_1' ;
}
if ( $lh [ 1 ] > 32 ) {
$lh [ 0 ] = 'hp_2' ;
}
if ( $lh [ 1 ] > 65 ) {
$lh [ 0 ] = 'hp_3' ;
}
if ( $sn [ 'mpAll' ] > 0 ) {
//мана
$lm = [ 0 => 'hp_none' , 1 => 1 ];
$lm [ 1 ] = floor ( $sn [ 'mpNow' ] / $sn [ 'mpAll' ] * 120 );
if ( $lm [ 1 ] > 0 ) {
$lm [ 0 ] = 'hp_mp' ;
}
$hpmp .= '<div id="vmp' . $u [ 'id' ] . '" title="Уровень маны" align="center" class="seemp" style="position:absolute; top:10px; left:-5px; width:120px; height:10px; z-index:12;">' .
floor ( $sn [ 'mpNow' ]) . '/' . ( 0 + $sn [ 'mpAll' ]) . ' </ div >
< div title = " Уровень маны " class = " hpborder " style = " position:absolute; top:10px; width:120px; height:9px; z-index:13; " >
< img src = " ' . Config::img() . '/1x1.gif " height = " 9 " width = " 1 " >
</ div >
< div class = " ' . $lm[0] . ' senohp " style = " height:9px; position:absolute; top:10px; width:' . $lm[1] . 'px; z-index:11; " id = " lmp' . $u['id'] . ' " >
< img src = " ' . Config::img() . '/1x1.gif " height = " 9 " width = " 1 " ></ div >
< div title = " Уровень маны " class = " hp_none " style = " position:absolute; top:10px; width:120px; height:10px; z-index:10; " ></ div > ' ;
} else {
$hptop = 5 ;
}
$hpmp = '<div id="vhp' . $u [ 'id' ] . '" title="Уровень жизни" align="center" class="seehp" style="position:absolute; top:' . $hptop . 'px; left:-5px; width:120px; height:10px; z-index:12;">' . floor (
$sn [ 'hpNow' ]
) . '/' . ( 0 + $sn [ 'hpAll' ]) . ' </ div >
< div title = " Уровень жизни " class = " hpborder " style = " position:absolute; top:' . $hptop . 'px; width:120px; height:9px; z-index:13; " >< img src = " ' . Config::img() . '/1x1.gif " height = " 9 " width = " 1 " ></ div >
< div class = " ' . $lh[0] . ' senohp " style = " height:9px; width:' . $lh[1] . 'px; position:absolute; top:' . $hptop . 'px; z-index:11; " id = " lhp' . $u['id'] . ' " >< img src = " ' . Config::img() . '/1x1.gif " height = " 9 " width = " 1 " ></ div >
< div title = " Уровень жизни " class = " hp_none " style = " position:absolute; top:' . $hptop . 'px; width:120px; height:10px; z-index:10; " >< img src = " ' . Config::img() . '/1x1.gif " height = " 10 " ></ div > ' . $hpmp ;
//Собираем Н Р и М Р
$hpmp = " <div style='position:relative;'> $hpmp </div> " ;
$pb = '' ;
if ( $u [ 'banned' ] > 0 ) {
$pb .= '<div style="margin:0 2px 0 2px;"><font color="red" style="background-color:#fae0e0"><strong>Персонаж заблокирован</strong></font></div>' ;
}
if ( $u [ 'allLock' ] > time ()) {
$pb .= '<div style="margin:0 2px 0 2px;"><font color="red" style="background-color:#fae0e0"><strong>Временный запрет передач!</strong></font></div>' ;
}
$swm = 0 ; //свитки магии
$l = 40 ;
while ( $l <= 52 ) {
if ( isset ( $witm [ $l ])) {
$swm ++ ;
} else {
$witm [ $l ] = '<img title="Пустой слот заклинания" src="' . Config :: img () . '/i/items/w/w101.gif">' ;
}
$l ++ ;
}
$ssm = 0 ; //слоты сумки
$l = 59 ;
while ( $l <= 62 ) {
if ( isset ( $witm [ $l ])) {
$ssm ++ ;
} else {
$witm [ $l ] = '<img width="60" height="60" title="Пустой слот сумка" src="' . Config :: img () . '/i/items/w/w83.gif">' ;
}
$l ++ ;
}
$witmg = '' ;
if ( $ssm > 0 && $i1 == 0 ) {
$witmg .= ' < table style = " padding-top:2px;padding-bottom:2px; " width = " 240 " border = " 0 " cellspacing = " 0 " cellpadding = " 0 " >
< tr >
< td width = " 60 " height = " 60 " > ' . $witm[59] . ' </ td >
< td width = " 60 " > ' . $witm[60] . ' </ td >
< td width = " 60 " > ' . $witm[61] . ' </ td >
< td width = " 60 " > ' . $witm[62] . ' </ td >
</ tr >
</ table > ' ;
}
if ( $swm > 0 && $i1 == 0 ) {
$witmg .= ' < table width = " 240 " border = " 0 " cellspacing = " 0 " cellpadding = " 0 " >
< tr >
< td width = " 40 " height = " 25 " > ' . $witm[40] . ' </ td >
< td width = " 40 " > ' . $witm[41] . ' </ td >
< td width = " 40 " > ' . $witm[42] . ' </ td >
< td width = " 40 " > ' . $witm[43] . ' </ td >
< td width = " 40 " > ' . $witm[44] . ' </ td >
< td width = " 40 " > ' . $witm[50] . ' </ td >
</ tr >
< tr >
< td height = " 25 " > ' . $witm[45] . ' </ td >
< td > ' . $witm[46] . ' </ td >
< td > ' . $witm[47] . ' </ td >
< td > ' . $witm[48] . ' </ td >
< td > ' . $witm[49] . ' </ td >
< td > ' . $witm[51] . ' </ td >
</ tr >
</ table > ' ;
}
$zag = '' ;
if ( $u [ 'zag' ] != '' && $i1 == 1 ) {
$rt [ 0 ] .= '<style> .inf2s { position:relative; filter: alpha(opacity=10); -moz-opacity: 0.10; -khtml-opacity: 0.10; opacity: 0.10; } .inf2s:hover { background-color:#e2e0e0;filter: alpha(opacity=70); -moz-opacity: 0.70; -khtml-opacity: 0.70; opacity: 0.70; } </style>' ;
$zag = '<img width="243" height="283" style="position:absolute;top:-1px;left:-1px;" src="' . Config :: img () . '/i/zag/' . $u [ 'zag' ] . '">' ;
$j2 = 0 ;
while ( $j2 <= 17 ) {
$witm [ $j2 ] = '<div class="inf2s">' . $witm [ $j2 ] . '</div>' ;
$j2 ++ ;
}
}
if ( $pb != '' ) {
$pb = '<div align="center" style="width:246px;"><!-- blocked -->' . $pb . '</div>' ;
}
$rt [ 0 ] .= '<div id="lgnthm" style="width:246px; padding:0 3px 0 3px;" align="center">' . $this -> user -> microLogin2 ( $u ) . '</div>' . $pb . '
< div class = " personag " style = " width:240px; background-color:#CCC; padding:3px; margin-right:11px; border-bottom:1px solid #666666; border-right:1px solid #666666; border-left:1px solid #FFFFFF; border-top:1px solid #FFFFFF; " >
< table width = " 240 " border = " 0 " cellspacing = " 0 " cellpadding = " 0 " >
< tr >
< td width = " 60 " valign = " top " >
< table bgcolor = " #e1e1e1 " width = " 60 " height = " 280 " border = " 0 " cellspacing = " 0 " cellpadding = " 0 " >
< tr >
< td height = " 60 " >< div style = " position:relative " > ' . $zag . $witm[1] . ' </ div ></ td >
</ tr >
< tr >
< td height = " 40 " > ' . $witm[2] . ' </ td >
</ tr >
< tr >
< td height = " 60 " > ' . $witm[3] . ' </ td >
</ tr >
< tr >
< td height = " 80 " > ' . $witm[4] . ' </ td >
</ tr >
< tr >
< td height = " 40 " > ' . $witm[7] . ' </ td >
</ tr >
</ table >
</ td >
< td height = " 280 " valign = " top " >
< table bgcolor = " #e1e1e1 " width = " 120 " height = " 280 " border = " 0 " cellspacing = " 0 " cellpadding = " 0 " >
< tr >
< td height = " 20 " bgcolor = " #CCC " valign = " top " >
<!-- HP and MP -->
' . $hpmp . '
<!-- -->
</ td >
</ tr >
< tr >
< td valign = " top " > ' ;
if ( $zag == '' ) {
if ( $i1 == 0 ) {
if ( ! isset ( $_GET [ 'inv' ])) {
$invg = [ 0 => 'main.php?inv=1' , 1 => 'Рюкзак' ];
} else {
$invg = [ 0 => 'main.php?skills=1' , 1 => 'Умения' ];
}
} else {
$o = mysql_fetch_array (
mysql_query (
'SELECT `id` FROM `obraz` WHERE `img` = "' . mysql_real_escape_string (
$this -> info [ 'obraz' ]
) . '" AND `sex` = "' . $this -> info [ 'sex' ] . '" LIMIT 1'
)
);
$invg = [ 0 => '/shadow/' . $o [ 'id' ] . '" target="_blank' , 1 => 'Галерея образов' ];
}
$uobr = 'i/obraz/' . $u [ 'sex' ] . '/' . $u [ 'obraz' ];
if ( isset ( $sn [ 'items_img' ][ 1 ])) {
$uobr = 'rimg/r' . $sn [ 'items_img' ][ 1 ];
}
$rt [ 0 ] .= ' < div style = " position:relative;height:220px; " >
<!-- образ -->
< div style = " position:absolute; width:120px; height:220px; z-index:1; " >< a href = " ' . $invg[0] . ' " >< img onMouseOver = " top.hi(this, \ 'Перейти в "<strong>' . $invg[1] . '</strong>" \ ',event,2,1,1,1, \ ' \ '); " onMouseOut = " top.hic(); " onMouseDown = " top.hic(); " width = " 120 " height = " 220 " src = " ' . Config::img() . '/' . $uobr . ' " ' . $oi . ' ></ a ></ div >
< div style = " position:absolute; width:120px; height:auto; z-index:3; " align = " left " > ' . $eff . ' </ div > ' . $anml . '
</ div > ' ;
} else {
if ( $i1 == 0 ) {
if ( ! isset ( $_GET [ 'inv' ])) {
$invg = [ 0 => 'main.php?inv=1' , 1 => 'Рюкзак' ];
} else {
$invg = [ 0 => 'main.php?skills=1' , 1 => 'Умения' ];
}
} else {
$invg = [ 0 => 'https://lib.new-combats.com/obraz.php?namez=' . $u [ 'zag' ] . '" target="_blank' , 1 => 'Галерея образов' ];
}
$rt [ 0 ] .= ' < div class = " inf2s " style = " position:relative;height:220px; " >
<!-- образ -->
< div style = " position:absolute; width:120px; height:220px; z-index:1; " >< a href = " ' . $invg[0] . ' " >< img onMouseOver = " top.hi(this, \ 'Перейти в "<strong>' . $invg[1] . '</strong>" \ ',event,2,1,1,1, \ ' \ '); " onMouseOut = " top.hic(); " onMouseDown = " top.hic(); " width = " 120 " height = " 220 " src = " ' . Config::img() . '/1x1.gif " ' . $oi . ' ></ a ></ div >
< div style = " position:absolute; width:120px; height:auto; z-index:3; " align = " left " > ' . $eff . ' </ div > ' . $anml . '
</ div > ' ;
}
unset ( $invg );
$rt [ 0 ] .= ' </ td >
</ tr >
< tr >
< td height = " 40 " >< div align = " center " > ' . $msl . ' </ div ></ td >
</ tr >
</ table >
</ td >
< td width = " 60 " valign = " top " >
< table bgcolor = " #e1e1e1 " width = " 60 " border = " 0 " cellspacing = " 0 " cellpadding = " 0 " >
< tr >
< td height = " 20 " > ' . $witm[8] . ' </ td >
</ tr >
< tr >
< td height = " 20 " > ' . $witm[9] . ' </ td >
</ tr >
< tr >
< td height = " 20 " >< table width = " 60 " border = " 0 " cellspacing = " 0 " cellpadding = " 0 " >
< tr >
< td width = " 20 " height = " 20 " > ' . $witm[10] . ' </ td >
< td width = " 20 " > ' . $witm[11] . ' </ td >
< td width = " 20 " > ' . $witm[12] . ' </ td >
</ tr >
</ table ></ td >
</ tr >
< tr >
< td height = " 40 " > ' . $witm[13] . ' </ td >
</ tr >
< tr >
< td height = " 60 " > ' . $witm[14] . ' </ td >
</ tr >
< tr >
< td height = " 80 " > ' . $witm[16] . ' </ td >
</ tr >
< tr >
< td height = " 40 " > ' . $witm[17] . ' </ td >
</ tr >
</ table >
</ td >
</ tr >
</ table > ' . $witmg . ' </ div > ' ;
if ( $i1 == 0 && $u [ 'battle' ] == 0 ) {
$rt [ 0 ] .= '<script>top.lafstReg[' . $u [ 'id' ] . '] = 0; top.startHpRegen("main",' . $u [ 'id' ] . ',' . ( 0 + $sn [ 'hpNow' ]) . ',' . ( 0 + $sn [ 'hpAll' ]) . ',' . ( 0 + $sn [ 'mpNow' ]) . ',' . ( 0 + $sn [ 'mpAll' ]) . ',' . ( time () - $u [ 'regHP' ]) . ',' . ( time () - $u [ 'regMP' ]) . ',' . ( 0 + $this -> user -> rgd [ 0 ]) . ',' . ( 0 + $this -> user -> rgd [ 1 ]) . ',1)</script>' ;
}
if ( $ivv == 0 && $i1 == 0 ) {
$rt [ 0 ] .= $this -> user -> info_remont ();
}
}
return $rt ;
}
private function nameItemMf ( $pl , $po )
{
$r = $pl [ 'name' ];
if ( isset ( $po [ 'icos' ])) {
$r = " <span class=icos_ { $po [ 'icos' ] } > { $pl [ 'name' ] } <span style='font-size:8px;'> { $po [ 'icos' ] } </span></span> " ;
}
if ( ! empty ( $po [ 'rune' ]) && $po [ 'rune' ] > 0 ) {
$r .= " <br><span style='color: green;'>Руна: <strong> { $po [ 'rune_name' ] } </strong></span> " ;
}
if ( isset ( $po [ 'spell' ])) {
$rnc = match ( explode ( ' ' , $po [ 'spell_name' ])[ 2 ]) {
'[0]' => '#282828' ,
'[1]' => '#624542' ,
'[2]' => '#77090b' ,
default => '#d99800' ,
};
$r .= " <br><span style='color: $rnc ;'>Руна: <strong> { $po [ 'spell_name' ] } </strong></span> " ;
}
return $r ;
}
private function getInfoItemInfo ( $pl , $po ) : string
{
$lvar = '' ;
if ( isset ( $po [ 'sv_yron_max' ]) && $po [ 'sv_yron_max' ] > 0 ) {
$lvar .= '<br>Урон: ' . $po [ 'sv_yron_min' ] . '-' . $po [ 'sv_yron_max' ];
}
$t = $this -> user -> items [ 'add' ];
$x = 0 ;
while ( $x < count ( $t )) {
$n = $t [ $x ];
if ( isset ( $po [ 'add_' . $n ], $this -> is [ $n ])) {
$z = '+' ;
if ( $po [ 'add_' . $n ] < 0 ) {
$z = '' ;
}
$lvar .= '<br>' . $this -> is [ $n ] . ': ' . $z . $po [ 'add_' . $n ];
}
$x ++ ;
}
//
$x = 0 ;
while ( $x < count ( $t )) {
$n = $t [ $x ];
if ( isset ( $po [ 'sv_' . $n ])) {
$z = '+' ;
if ( $po [ 'sv_' . $n ] < 0 ) {
$z = '' ;
}
if ( $n != 'yron_min' && $n != 'yron_max' ) {
$lvar .= '<br>' . $this -> is [ $n ] . ': ' . $z . $po [ 'sv_' . $n ];
}
}
$x ++ ;
}
2023-11-06 00:40:12 +00:00
if ( isset ( $pl [ '2h' ]) && $pl [ '2h' ] == 1 ) {
2023-11-02 13:57:39 +00:00
$lvar .= '<br>• Двуручное оружие' ;
}
if ( isset ( $po [ 'zonb' ])) {
$lvar .= '<br>Зоны блокирования: ' ;
if ( $po [ 'zonb' ] > 0 ) {
$x = 1 ;
while ( $x <= $po [ 'zonb' ]) {
$lvar .= '+' ;
$x ++ ;
}
} else {
$lvar .= '—' ;
}
}
//
if ( isset ( $po [ 'add_mib1' ], $po [ 'add_mab1' ]) && $po [ 'add_mib1' ] > 0 && $po [ 'add_mib1' ] <= $po [ 'add_mab1' ]) {
$lvar .= '<br>Броня головы: ' . ( int ) $po [ 'add_mib1' ] . '-' . ( int ) $po [ 'add_mab1' ];
}
if ( isset ( $po [ 'add_mib2' ], $po [ 'add_mab2' ]) && $po [ 'add_mib2' ] > 0 && $po [ 'add_mib2' ] <= $po [ 'add_mab2' ]) {
$lvar .= '<br>Броня корпуса: ' . ( int ) $po [ 'add_mib2' ] . '-' . ( int ) $po [ 'add_mab2' ];
}
if ( isset ( $po [ 'add_mib3' ], $po [ 'add_mab3' ]) && $po [ 'add_mib3' ] > 0 && $po [ 'add_mib3' ] <= $po [ 'add_mab3' ]) {
$lvar .= '<br>Броня пояса: ' . ( int ) $po [ 'add_mib2' ] . '-' . ( int ) $po [ 'add_mab2' ];
}
if ( isset ( $po [ 'add_mib4' ], $po [ 'add_mab4' ]) && $po [ 'add_mib4' ] > 0 && $po [ 'add_mib4' ] <= $po [ 'add_mab4' ]) {
$lvar .= '<br>Броня ног: ' . ( int ) $po [ 'add_mib2' ] . '-' . ( int ) $po [ 'add_mab2' ];
}
2023-11-06 00:40:12 +00:00
if ( isset ( $pl [ 'iznosMAX' ]) && $pl [ 'iznosMAX' ] > 0 ) {
2023-11-02 13:57:39 +00:00
$lvar .= '<br>Долговечность: ' . floor ( $pl [ 'iznosNOW' ]) . DIRECTORY_SEPARATOR . ceil ( $pl [ 'iznosMAX' ]);
}
if ( ! empty ( $po [ 'battleUseZd' ]) && $po [ 'battleUseZd' ] > 0 ) {
$lvar .= '<br>Задержка использования: ' . Conversion :: secondsToTimeout ( $po [ 'battleUseZd' ]);
}
if ( isset ( $po [ 'gravi' ])) {
$lvar .= '<hr><strong>"<i>' . $po [ 'gravi' ] . '</i>"</strong>' ;
}
return $lvar ;
}
}