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] = '';
$witm[2] = '';
$witm[3] = '';
$witm[4] = '';
$witm[7] = '';
$witm[8] = '';
$witm[9] = '';
$witm[10] = '';
$witm[11] = '';
$witm[12] = '';
$witm[13] = '';
$witm[14] = '';
$witm[16] = '';
$witm[17] = '';
//40-52 слот под магию
$witm[53] = '';
$witm[54] = '';
$witm[55] = '';
$witm[56] = '';
$witm[57] = '';
$witm[58] = '';
$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']] = '';
if ($i1 == 1) {
$witm[$pl['inOdet']] = '' . $witm[$pl['inOdet']] . '';
} 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 = '
| "' . $pl['name'] . '" Использовать сейчас? |
';
$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 = ' | "' . $pl['name'] . '" Использовать сейчас? |
';
$useUrl = 'top.useiteminv(\'' . (0 + $pl['id']) . '\',\'' . $pl['img'] . '\',\'' . $pl['img'] . '\',1,\'' . $pldate . '\',\'' . (0 + $_GET['otdel']) . '\');';
}
}
$witm[$pl['inOdet']] = '' . $witm[$pl['inOdet']] . '';
} elseif ($pl['item_id'] == 998 && !isset($_GET['inv'])) {
//варежки
$witm[$pl['inOdet']] = '' . $witm[$pl['inOdet']] . '';
} else {
$witm[$pl['inOdet']] = '' . $witm[$pl['inOdet']] . '';
}
}
}
//Шлем,Венок
$wj1i = '';
$br = '';
if ($wj[1]) {
if (!empty($wj[52])) {
$wj1i .= $br;
}
$td = Conversion::dataStringToArray($wj[1]['data']);
$wj[1]['name'] = $this->nameItemMf($wj[1], $td);
$wj1i .= '' . $wj[1]['name'] . '';
$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 = '' . $wj[52]['name'] . '' . $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 .= '' . $wj[6]['name'] . '';
$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 .= '' . $wj[5]['name'] . '';
$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 .= '' . $wj[4]['name'] . '';
$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] = '';
if ($i1 == 1) {
$witm[1] = '' . $witm[1] . '';
} else {
$witm[1] = '' . $witm[1] . '';
}
}
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] = '';
if ($i1 == 1) {
if ($wj4idd > 0 && isset($wj[4]['item_id'])) {
$wj[4]['item_id'] = $wj4idd;
}
$witm[4] = '' . $witm[4] . '';
} else {
$witm[4] = '' . $witm[4] . '';
}
}
/*------------ ГЕНЕРИРУЕМ ИНФ. О ПЕРСОНАЖЕ ---------------*/
$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 = '';
} else {
$anml = '';
}
}
}
if (isset($sn['items_img'][2])) {
$msl = '';
} else {
if ($anml == '') {
$msl = '';
} 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 = '
' . $witm[53] . ' |
' . $witm[55] . ' |
' . $witm[54] . ' |
' . $witm[56] . ' |
' . $witm[57] . ' |
' . $witm[58] . ' |
';
}
$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 = '' . $e['name'] . '';
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 .= '
';
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 .= '
' . $this->is[$n] . ': ' . $z . $ed['add_' . $n];
}
$x++;
}
if ($tr != '') {
$ei .= $tr;
}
if ($e['info'] != '') {
$ei .= '
Информация:
' . $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 .= '';
} 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 .= '' .
floor($sn['mpNow']) . '/' . (0 + $sn['mpAll']) . '
';
} else {
$hptop = 5;
}
$hpmp = '' . floor(
$sn['hpNow']
) . '/' . (0 + $sn['hpAll']) . '
' . $hpmp;
//Собираем НР и МР
$hpmp = "$hpmp
";
$pb = '';
if ($u['banned'] > 0) {
$pb .= 'Персонаж заблокирован
';
}
if ($u['allLock'] > time()) {
$pb .= 'Временный запрет передач!
';
}
$swm = 0; //свитки магии
$l = 40;
while ($l <= 52) {
if (isset($witm[$l])) {
$swm++;
} else {
$witm[$l] = '';
}
$l++;
}
$ssm = 0; //слоты сумки
$l = 59;
while ($l <= 62) {
if (isset($witm[$l])) {
$ssm++;
} else {
$witm[$l] = '';
}
$l++;
}
$witmg = '';
if ($ssm > 0 && $i1 == 0) {
$witmg .= '
' . $witm[59] . ' |
' . $witm[60] . ' |
' . $witm[61] . ' |
' . $witm[62] . ' |
';
}
if ($swm > 0 && $i1 == 0) {
$witmg .= '
' . $witm[40] . ' |
' . $witm[41] . ' |
' . $witm[42] . ' |
' . $witm[43] . ' |
' . $witm[44] . ' |
' . $witm[50] . ' |
' . $witm[45] . ' |
' . $witm[46] . ' |
' . $witm[47] . ' |
' . $witm[48] . ' |
' . $witm[49] . ' |
' . $witm[51] . ' |
';
}
$zag = '';
if ($u['zag'] != '' && $i1 == 1) {
$rt[0] .= '';
$zag = '';
$j2 = 0;
while ($j2 <= 17) {
$witm[$j2] = '' . $witm[$j2] . '
';
$j2++;
}
}
if ($pb != '') {
$pb = '' . $pb . '
';
}
$rt[0] .= '' . $this->user->getLogin($u['id']) . '
' . $pb . '
' . $zag . $witm[1] . ' |
' . $witm[2] . ' |
' . $witm[3] . ' |
' . $witm[4] . ' |
' . $witm[7] . ' |
|
' . $hpmp . '
|
';
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] .= '
' . $eff . ' ' . $anml . '
';
} 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] .= '
' . $eff . ' ' . $anml . '
';
}
unset($invg);
$rt[0] .= ' |
' . $msl . ' |
|
' . $witm[8] . ' |
' . $witm[9] . ' |
' . $witm[10] . ' |
' . $witm[11] . ' |
' . $witm[12] . ' |
|
' . $witm[13] . ' |
' . $witm[14] . ' |
' . $witm[16] . ' |
' . $witm[17] . ' |
|
' . $witmg . '
';
if ($i1 == 0 && $u['battle'] == 0) {
$rt[0] .= '';
}
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 = "{$pl['name']} {$po['icos']} ";
}
if (!empty($po['rune']) && $po['rune'] > 0) {
$r .= "
Руна: {$po['rune_name']}";
}
if (isset($po['spell'])) {
$rnc = match (explode(' ', $po['spell_name'])[2]) {
'[0]' => '#282828',
'[1]' => '#624542',
'[2]' => '#77090b',
default => '#d99800',
};
$r .= "
Руна: {$po['spell_name']}";
}
return $r;
}
private function getInfoItemInfo($pl, $po): string
{
$lvar = '';
if (isset($po['sv_yron_max']) && $po['sv_yron_max'] > 0) {
$lvar .= '
Урон: ' . $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 .= '
' . $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 .= '
' . $this->is[$n] . ': ' . $z . $po['sv_' . $n];
}
}
$x++;
}
if (isset($pl['2h']) && $pl['2h'] == 1) {
$lvar .= '
• Двуручное оружие';
}
if (isset($po['zonb'])) {
$lvar .= '
Зоны блокирования: ';
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 .= '
Броня головы: ' . (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 .= '
Броня корпуса: ' . (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 .= '
Броня пояса: ' . (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 .= '
Броня ног: ' . (int)$po['add_mib2'] . '-' . (int)$po['add_mab2'];
}
if (isset($pl['iznosMAX']) && $pl['iznosMAX'] > 0) {
$lvar .= '
Долговечность: ' . floor($pl['iznosNOW']) . DIRECTORY_SEPARATOR . ceil($pl['iznosMAX']);
}
if (!empty($po['battleUseZd']) && $po['battleUseZd'] > 0) {
$lvar .= '
Задержка использования: ' . Conversion::secondsToTimeout($po['battleUseZd']);
}
if (isset($po['gravi'])) {
$lvar .= '
"' . $po['gravi'] . '"';
}
return $lvar;
}
}