game/_incl_data/class/User/Stats.php

1529 lines
56 KiB
PHP
Raw Normal View History

<?php
namespace User;
2022-12-30 19:03:37 +00:00
use Core\Db;
2023-08-15 22:48:29 +00:00
use Helper\Conversion;
use Item\Data\Bonuses;
use Item\Data\Bonuses as ItemBonuses;
use User;
class Stats
{
2023-08-15 22:48:29 +00:00
private User $u;
public function __construct(User $user)
{
$this->u = $user;
}
/**
2023-08-15 22:48:29 +00:00
* Собирает суммы всех бонусов с одетых предметов, комплектов предметов, активных эфектов.
* @param int $userId
* @return array
*/
2023-08-15 22:48:29 +00:00
public static function getAllBonuses(int $userId): array
{
2023-08-15 22:48:29 +00:00
$iData = [];
$im = ItemsModel::getWearedItems($userId);
foreach ($im as $item) {
$iData[] = $item['data'];
}
$iData[] = Db::getValue('select data from eff_users where uid = ? and `delete` = 0', [$userId]);
2022-12-30 19:03:37 +00:00
$params = [];
2023-08-15 22:48:29 +00:00
$complects = [];
foreach ($iData as $datum) {
2023-08-15 22:48:29 +00:00
$arr = Conversion::dataStringToArray($datum);
foreach ($arr as $k => $v) {
if ($k === 'complect') {
if (isset($complects[$v])) {
$complects[$v]++;
} else {
2023-08-15 22:48:29 +00:00
$complects[$v] = 1;
}
}
2023-08-15 22:48:29 +00:00
if (strpos($k, 'add_') === false) {
continue;
}
$k = str_replace('add_', '', $k);
self::setBonusValue($params, $k, $v);
}
}
$params = self::addComplectsBonuses($complects, $params);
return $params;
}
private static function setBonusValue(array &$array, $key, $value)
{
if (isset($array[$key])) {
$array[$key] += $value;
} else {
$array[$key] = $value;
}
}
/**
* @param array $complects
* @param array $params
* @return array
*/
private static function addComplectsBonuses(array $complects, array $params): array
{
$cdata = [];
if (!empty($complects)) {
foreach ($complects as $complectId => $wearedItemsQuantity) {
$cdata[] = Db::getValue('select data from complects where com = ? and x <= ? order by x desc limit 1', [$complectId, $wearedItemsQuantity]);
}
foreach ($cdata as $datum) {
$arr = Conversion::dataStringToArray($datum);
foreach ($arr as $k => $v) {
self::setBonusValue($params, $k, $v);
}
}
}
return $params;
}
/** Данные для отрисовки логина и полосок жизни\маны.
* @param User $u
* @return object
*/
public static function getLoginHpManaBars(User $u): object
{
$hpNow = floor($u->stats['hpNow']);
$hpAll = $u->stats['hpAll'];
$mpNow = floor($u->stats['mpNow']);
$mpAll = $u->stats['mpAll'];
//floor(120 / 100 * ($hpNow / $hpAll * 100)); // ??????
$ph = ($hpAll > 0 && $hpNow > 0) ? floor(120 / $hpNow / $hpAll) : 0;
$pm = ($mpAll > 0 && $mpNow > 0) ? floor(120 / $mpNow / $mpAll) : 0;
return (object)[
'uid' => $u->info['id'],
'login' => $u->microLogin($u->info['id']),
'hpbarwidth' => $ph,
'mpbarwidth' => $pm,
'hpbartext' => ' ' . $hpNow . '/' . $hpAll,
'mpbartext' => ' ' . $mpNow . '/' . $mpAll,
'divstyle' => $pm === 0 ? ' margin-top:13px;' : '',
'hasmana' => $mpAll > 0,
];
}
2023-08-15 22:48:29 +00:00
/**
* Присваиваем только разрешенные значения.
*/
private static function a(&$array, string $key, $value): array
{
if (!in_array($key, array_keys(Bonuses::getBonusSystemNames()))) {
return [];
}
$array[$key] = $value;
return $array;
}
public function getStats($uid, $i1 = null, $res = 0, $reimg = false, $btl_cache = false, $minimal = false): array
{
if (is_array($uid)) {
$u = $uid;
} elseif ($uid != $this->u->info['id'] || $res == 1) {
$u = User::getInfo($uid);
} else {
$u = $this->u->info;
}
if (!isset($u['id'], $u['stats'])) {
return [];
}
$st = [
'maxves' => 0,
'pzm' => 0,
'yza' => 0,
'yza1' => 0,
'yza2' => 0,
'yza3' => 0,
'yza4' => 0,
'yza5' => 0,
'yza6' => 0,
'yza7' => 0,
'yzm' => 0,
'yzm1' => 0,
'yzm2' => 0,
'yzm3' => 0,
'yzm4' => 0,
'yzm5' => 0,
'yzm6' => 0,
'yzm7' => 0,
'yzma' => 0,
'pbe' => 0,
'os7' => 0,
'' => 0,
];
$s_vi = [];
$s_v = [];
$u['clanpos'] = 0;
if ($u['clan'] > 0) {
$r1 = Db::getValue('select pos from aaa_clan_reting_list where clan = ? and date = ? limit 1', [$u['clan'], date('dmY')]);
if (!empty($r1)) {
$st['clanpos'] = $r1;
}
}
$lvl = Db::getRow('select * from levels where upLevel = ?', [$u['upLevel']]);
if (isset($lvl['upLevel'])) {
$st['levels'] = $lvl;
} else {
$st['levels'] = 'undefined';
}
$st2 = [];
$st['id'] = $u['id'];
$st['login'] = $u['login'];
$st['lvl'] = $u['level'];
$st['hpNow'] = $u['hpNow'];
$st['hpAll'] = 0;
$st['mpNow'] = $u['mpNow'];
$st['mpAll'] = 0;
$st['zona'] = 1;
$st['zonb'] = 2;
$st['items'] = [];
$st['effects'] = [];
$st['reting'] = 0;
$st['vip'] = $u['vip'];
$stats = Conversion::dataStringToArray($u['stats']);
foreach ($stats as $stat => $value) {
if (isset($st[$stat]) && is_numeric($value)) {
$st[$stat] += $value;
} else {
$st[$stat] = $value;
}
}
unset($stats);
//Шаблонные картинки
if ($this->u->info['id'] === $u['id'] || $reimg) {
$itemsImages = Db::getRows('select * from items_img where uid = ? and img_id != 0', [$u['id']]);
2023-08-15 22:48:29 +00:00
foreach ($itemsImages as $itemsImage) {
$reimage = Db::getRow('select * from reimage where ((uid = ? and clan = 0) or clan = ?) and good > 0 and bad = 0 and id = ?', [$u['id'], $u['clan'], $itemsImage['img_id']]);
if (isset($reimage['id'])) {
$st['items_img'][$itemsImage['type']] = $reimage['id'] . '.' . $reimage['format'];
} else {
Db::sql('update items_img set img_id = 0 where id = ?', [$itemsImage['id']]);
}
}
}
//Характеристики от предметов //ТУТ tr_lvl
// Вся вторая строчка - спасибо Users.
$wearedItems = Db::getRows('select type, data, inOdet,
item_id, inslot, useInBattle, btl_zd, iznosNOW, iznosMAX, magic_inci, name, items_users.id, img, `2h`
from items_users left join items_main on items_main.id = item_id where inOdet != 0 and uid = ?', [$u['id']]);
$ia = ItemBonuses::getBonusSystemNames();
$h = 0;
$hnd1 = 0;
$hnd2 = 0;
$sht1 = 0;
$reitm = [];
$coms = []; // комплекты
$dom = [];
$oza = [
1 => [0, 0],
2 => [0, 0],
3 => [0, 0],
4 => [0, 0],
]; //особенности защиты
$ozm = [
1 => [0, 0],
2 => [0, 0],
3 => [0, 0],
4 => [0, 0],
]; //особенности магии
$st['reting'] = 0;
foreach ($wearedItems as $wearedItem) {
$st['wp' . $wearedItem['inOdet'] . 'id'] = $h;
$st['items'][$h] = $wearedItem;
$h++;
if ($wearedItem['inOdet'] == 3 && (($wearedItem['type'] >= 18 && $wearedItem['type'] <= 24) || $wearedItem['type'] == 26 || $wearedItem['type'] == 27 || $wearedItem['type'] == 28)) {
$hnd1 = 1;
}
if ($wearedItem['inOdet'] == 14 && (($wearedItem['type'] >= 18 && $wearedItem['type'] <= 24) || $wearedItem['type'] == 26 || $wearedItem['type'] == 27 || $wearedItem['type'] == 28)) {
$hnd2 = 1;
} elseif ($wearedItem['inOdet'] == 14 && $wearedItem['type'] == 13) {
$sht1 = 1;
}
$sts = explode('|', $wearedItem['data']);
$i = 0;
$sti = [];
while ($i < count($sts)) {
$ste = explode('=', $sts[$i]);
if (isset($ste[1])) {
if (!isset($sti[$ste[0]])) {
$sti[$ste[0]] = 0;
}
$sti[$ste[0]] += intval($ste[1]);
}
$i++;
}
if ($wearedItem['inOdet'] <= 18 && $wearedItem['inOdet'] > 0) {
$st['reting'] += 1;
}
$ko = 1;
while ($ko <= 4) {
if (isset($sti['add_oza' . $ko])) {
if (isset($sti['add_oza'])) {
if ($sti['add_oza'] == 1) {
//Слабая
$oza[$ko][0] += 1;
$oza[$ko][1] += 9;
} elseif ($sti['add_oza'] == 2) {
//Нормальная
$oza[$ko][0] += 20;
$oza[$ko][1] += 39;
} elseif ($sti['add_oza'] == 3) {
//Хорошая
$oza[$ko][0] += 40;
$oza[$ko][1] += 69;
} elseif ($sti['add_oza'] == 4) {
//Посредственная
$oza[$ko][0] += 10;
$oza[$ko][1] += 19;
} elseif ($sti['add_oza'] == 5) {
//Великолепная
$oza[$ko][0] += 70;
$oza[$ko][1] += 89;
}
}
if (isset($sti['add_ozm'])) {
if ($sti['add_ozm'] == 1) {
//Слабая
$ozm[$ko][0] += 1;
$ozm[$ko][1] += 9;
} elseif ($sti['add_ozm'] == 2) {
//Нормальная
$ozm[$ko][0] += 20;
$ozm[$ko][1] += 39;
} elseif ($sti['add_ozm'] == 3) {
//Хорошая
$ozm[$ko][0] += 40;
$ozm[$ko][1] += 69;
} elseif ($sti['add_ozm'] == 4) {
//Посредственная
$ozm[$ko][0] += 10;
$ozm[$ko][1] += 19;
} elseif ($sti['add_ozm'] == 5) {
//Великолепная
$ozm[$ko][0] += 70;
$ozm[$ko][1] += 89;
}
} else {
$ozm[$ko][0] += 1;
$ozm[$ko][1] += 9;
}
if ($sti['add_oza' . $ko] == 1) {
//Слабая
$oza[$ko][0] += 1;
$oza[$ko][1] += 9;
} elseif ($sti['add_oza' . $ko] == 2) {
//Нормальная
$oza[$ko][0] += 20;
$oza[$ko][1] += 39;
} elseif ($sti['add_oza' . $ko] == 3) {
//Хорошая
$oza[$ko][0] += 40;
$oza[$ko][1] += 69;
} elseif ($sti['add_oza' . $ko] == 4) {
//Посредственная
$oza[$ko][0] += 10;
$oza[$ko][1] += 19;
} elseif ($sti['add_oza' . $ko] == 5) {
//Великолепная
$oza[$ko][0] += 70;
$oza[$ko][1] += 89;
}
if (isset($sti['add_ozm' . $ko])) {
if ($sti['add_ozm' . $ko] == 1) {
//Слабая
$ozm[$ko][0] += 1;
$ozm[$ko][1] += 9;
} elseif ($sti['add_ozm' . $ko] == 2) {
//Нормальная
$ozm[$ko][0] += 20;
$ozm[$ko][1] += 39;
} elseif ($sti['add_ozm' . $ko] == 3) {
//Хорошая
$ozm[$ko][0] += 40;
$ozm[$ko][1] += 69;
} elseif ($sti['add_ozm' . $ko] == 4) {
//Посредственная
$ozm[$ko][0] += 10;
$ozm[$ko][1] += 19;
} elseif ($sti['add_ozm' . $ko] == 5) {
//Великолепная
$ozm[$ko][0] += 70;
$ozm[$ko][1] += 89;
}
} else {
$ozm[$ko][0] += 1;
$ozm[$ko][1] += 9;
}
}
$ko++;
}
if (isset($sti['art'])) {
if (!isset($st['art'])) {
$st['art'] = 0;
}
$st['art'] += $sti['art'];
}
if (isset($sti['maks_itm'])) {
if (!isset($st['maks_itm'])) {
$st['maks_itm'] = 0;
}
$st['maks_itm'] += $sti['maks_itm'];
}
if (isset($sti['complect'])) {
$coms[count($coms)]['id'] = $sti['complect'];
if (!isset($coms['com'][$sti['complect']])) {
$coms['com'][$sti['complect']] = 0;
if (!isset($coms['new'])) {
$coms['new'] = [];
}
$coms['new'][count($coms['new'])] = $sti['complect'];
}
$coms['com'][$sti['complect']]++;
}
if (isset($sti['complect2'])) {
$coms[count($coms)]['id'] = $sti['complect2'];
if (!isset($coms['com'][$sti['complect2']])) {
$coms['com'][$sti['complect2']] = 0;
if (!isset($coms['new'])) {
$coms['new'] = [];
}
$coms['new'][count($coms['new'])] = $sti['complect2'];
}
$coms['com'][$sti['complect2']]++;
}
if (isset($sti['zonb']) && $sti['zonb'] != 0) {
if (!isset($st['zonb'])) {
$st['zonb'] = 0;
}
$st['zonb'] += $sti['zonb'];
}
if (isset($sti['zona']) && $sti['zona'] != 0) {
if (!isset($st['zona'])) {
$st['zona'] = 0;
}
$st['zona'] += $sti['zona'];
}
//Добавляем статы от данного предмета
if (!isset($sti['restart_stats'])) {
$i = 0;
while ($i < count($ia)) {
//Действует на (Действует на)
if (isset($ia[$i]) && isset($sti['add_' . $ia[$i]])) {
if ($ia[$i] != 'zmproc' && $ia[$i] != 'zaproc') {
if (!isset($st[$ia[$i]])) {
$st[$ia[$i]] = 0;
}
$st[$ia[$i]] += intval($sti['add_' . $ia[$i]]);
} else {
if (!isset($st[$ia[$i]])) {
$st[$ia[$i]] = 0;
}
$st[$ia[$i]] = 100 - $st[$ia[$i]];
$st[$ia[$i]] = $st[$ia[$i]] - $st[$ia[$i]] / 100 * intval($sti['add_' . $ia[$i]]);
$st[$ia[$i]] = 100 - $st[$ia[$i]];
}
}
$i++;
}
} else {
$reitm[] = $sti;
}
$i = 0;
while ($i < count($ia)) {
if (isset($ia[$i]) && isset($sti['sv_' . $ia[$i]])) {
if (!isset($s_v[$ia[$i]])) {
$s_v[$ia[$i]] = 0;
$s_v['z'][$wearedItem['inOdet']][$ia[$i]] = 0;
}
$s_v[$ia[$i]] += intval($sti['sv_' . $ia[$i]]);
$s_v['z'][$wearedItem['inOdet']][$ia[$i]] += intval($sti['sv_' . $ia[$i]]);
}
$i++;
}
}
//Сохраненные хар-ки и умения
if (!empty($reitm)) {
$i39 = [0 => 0, 1 => 0, 2 => 0];
$i = 0;
while ($i < count($reitm)) {
if (isset($reitm[$i]['sm_skill']) && $i39[0] == 0) {
//умения
$i9 = 1;
$i39[0] = 1;
while ($i9 <= 7) {
$st['a' . $i9] = $st['a' . $i9] - $st2['a' . $i9] + $reitm[$i]['add_a' . $i9];
$st['mg' . $i9] = $st['mg' . $i9] - $st2['mg' . $i9] + $reitm[$i]['add_mg' . $i9];
$i9++;
}
} elseif (isset($reitm[$i]['sm_abil']) && $i39[1] == 0) {
//статы
$i9 = 1;
$i39[1] = 1;
while ($i9 <= 12) {
$st['s' . $i9] = $st['s' . $i9] - $st2['s' . $i9] + $reitm[$i]['add_s' . $i9];
$i9++;
}
} elseif (isset($reitm[$i]['sm_skill2']) && $i39[2] == 0) {
//навыки
$i39[2] = 1;
}
$i++;
}
}
//Харки от иконок
$efs = mysql_query(
'SELECT * FROM `users_ico` WHERE `uid`="' . mysql_real_escape_string(
$u['id']
) . '" AND (`endTime` > "' . time() . '" OR `endTime` = 0)'
);
while ($e = mysql_fetch_array($efs)) {
$sts = Conversion::dataStringToArray($e['bonus']);
$i = 0;
while ($i < count($ia)) {
if (isset($ia[$i])) {
if (!isset($sti[$ia[$i]])) {
$sti[$ia[$i]] = 0;
}
if (!isset($sts['add_' . $ia[$i]])) {
$sts['add_' . $ia[$i]] = 0;
}
$sti[$ia[$i]] += intval($sts['add_' . $ia[$i]]);
if (!isset($st[$ia[$i]])) {
$st[$ia[$i]] = 0;
}
//
$st[$ia[$i]] += intval($sts['add_' . $ia[$i]]);
}
$i++;
}
}
$noeffectbattle = false;
if ($u['battle'] > 0) {
$noeffectbattle = (bool)Db::getValue("select 1 from battle_actions where uid = ? and vars = 'noeffectbattle1' and btl = ? limit 1", [$u['id'], $u['battle']]);
}
//Характеристики от эффектов
$h = 0;
$nbs = [
4899 => 0,
4900 => 0,
4901 => 0,
4902 => 0,
4903 => 0,
4904 => 0,
4905 => 0,
4906 => 0,
4907 => 0,
4908 => 0,
4909 => 0,
];
$prsu = [];
if (!$noeffectbattle) {
$efs = mysql_query(
'SELECT
`eu`.`id`,
`eu`.`id_eff`,
`eu`.`tr_life_user`,
`eu`.`uid`,
`eu`.`name`,
`eu`.`data`,
`eu`.`overType`,
`eu`.`timeUse`,
`eu`.`timeAce`,
`eu`.`user_use`,
`eu`.`delete`,
`eu`.`v1`,
`eu`.`v2`,
`eu`.`img2`,
`eu`.`x`,
`eu`.`hod`,
`eu`.`bj`,
`eu`.`sleeptime`,
`eu`.`no_Ace`,
`em`.`id2`,`em`.`mname`,`em`.`type1`,`em`.`img`,`em`.`mdata`,`em`.`actionTime`,`em`.`type2`,`em`.`type3`,`em`.`onlyOne`,`em`.`oneType`,`em`.`noAce`,`em`.`see`,`em`.`info`,`em`.`overch`,`em`.`bp`,`em`.`noch` FROM `eff_users` AS `eu` LEFT JOIN `eff_main` AS `em` ON (`eu`.`id_eff` = `em`.`id2`) WHERE `eu`.`uid`="' . mysql_real_escape_string(
$u['id']
) . '" AND `eu`.`delete`="0" AND `eu`.`deactiveTime` < "' . time() . '" AND `eu`.`v1`!="priem" ORDER BY `eu`.`id` DESC LIMIT 50'
);
while ($e = mysql_fetch_array($efs)) {
if ($u['dnow'] == 0) {
if ($u['battle'] == 0) {
mysql_query(
'DELETE FROM `eff_users` WHERE `id_eff` = "' . $e['id_eff'] . '" AND `uid` = "' . $u['id'] . '" AND `id` != "' . $e['id'] . '" ORDER BY `id` ASC'
);
//Переводим в заряды
if ($e['v1'] != 'priem' && $e['hod'] != -1) {
mysql_query(
'UPDATE `eff_users` SET `hod` = "-1",`timeUse` = "' . (time() + ($e['hod'] * Config::get(
'effz'
)) - $e['actionTime']) . '" WHERE `id` = "' . $e['id'] . '" LIMIT 1'
);
}
} else {
if ($e['v1'] != 'priem' && Config::get('effz') > 0 && $e['hod'] == -1) {
$efzz = round(($e['timeUse'] + $e['actionTime'] + $e['timeAce']) - time());
if ($efzz > 0) {
mysql_query(
'UPDATE `eff_users` SET `hod` = "' . ($efzz / Config::get(
'effz'
)) . '" WHERE `id` = "' . $e['id'] . '" LIMIT 1'
);
}
}
}
}
if ($e['timeUse'] + $e['timeAce'] + $e['actionTime'] > time() || $e['timeUse'] == 77) {
if ($e['v1'] == 'priem') {
$prsu[$e['v2']] = 0 + $prsu['x'];
}
$st['effects'][$h] = $e;
$h++;
$sts = Conversion::dataStringToArray($e['data']);
if (isset($sts['itempl']) && $sts['itempl'] > 0) {
$nbs[$sts['itempl']] += 1;
}
if (isset($sts['puti'])) {
$st['puti'] = $sts['puti'];
}
if (isset($sts['add_silver'])) {
$st['slvtm'] = $e['timeUse'] + $e['actionTime'];
}
$i = 0;
while ($i < count($ia)) {
if (isset($ia[$i])) {
if (isset($sts['add_' . $ia[$i]])) {
if (!isset($sti[$ia[$i]])) {
$sti[$ia[$i]] = 0;
}
$sti[$ia[$i]] += intval($sts['add_' . $ia[$i]]);
}
if (isset($sts['add_' . $ia[$i]])) {
if ($ia[$i] != 'zaproc' && $ia[$i] != 'zmproc') {
if (!isset($st[$ia[$i]])) {
$st[$ia[$i]] = 0;
}
$st[$ia[$i]] += intval($sts['add_' . $ia[$i]]);
} else {
if (!isset($st[$ia[$i]])) {
$st[$ia[$i]] = 0;
}
$st[$ia[$i]] = 100 - $st[$ia[$i]];
$st[$ia[$i]] = $st[$ia[$i]] - $st[$ia[$i]] / 100 * intval(
$sts['add_' . $ia[$i]]
);
$st[$ia[$i]] = 100 - $st[$ia[$i]];
}
}
}
$i++;
}
$i = 0;
while ($i < count($ia)) {
if (isset($ia[$i])) {
if (isset($sts['sv_' . $ia[$i]])) {
if (!isset($s_vi[$ia[$i]])) {
$s_vi[$ia[$i]] = 0;
}
$s_vi[$ia[$i]] += intval($sts['sv_' . $ia[$i]]);
}
if (isset($sts['sv_' . $ia[$i]])) {
if (!isset($s_v[$ia[$i]])) {
$s_v[$ia[$i]] = 0;
}
$s_v[$ia[$i]] += intval($sts['sv_' . $ia[$i]]);
}
}
$i++;
}
} else {
//удаляем эффект
if ($e['img2'] != 'tz.gif' || $u['id'] == $this->u->info['id']) {
if ($e['sleeptime'] == 0) {
$this->u->endEffect($e['id'], $u);
}
$st['act'] = 1;
}
}
}
} else {
$st['noeffectbattle1'] = 1;
}//Заглушки от эффектов
if ($nbs[4899] > 0) {
//Зеленый комплект
$st['items_img'][8] = 'robe_illusion4.gif';
$st['items_img'][11] = 'leg_illusion4.gif';
} elseif ($nbs[4900] > 0) {
//Золото комплект
$st['items_img'][8] = 'robe_illusion5.gif';
$st['items_img'][11] = 'leg_illusion5.gif';
} elseif ($nbs[4901] > 0) {
//Голубой комплект
$st['items_img'][8] = 'robe_illusion3.gif';
$st['items_img'][11] = 'leg_illusion3.gif';
} elseif ($nbs[4902] > 0) {
//Синий комплект
$st['items_img'][8] = 'robe_illusion6.gif';
$st['items_img'][11] = 'leg_illusion6.gif';
} elseif ($nbs[4903] > 0) {
//Желтый комплект
$st['items_img'][8] = 'robe_illusion8.gif';
$st['items_img'][11] = 'leg_illusion8.gif';
} elseif ($nbs[4904] > 0) {
//Сиреневое платье
$st['items_img'][8] = 'robe_illusion7.gif';
$st['items_img'][11] = 'leg_illusion7.gif';
} elseif ($nbs[4905] > 0) {
//Оранжевое платье
$st['items_img'][8] = 'robe_illusion9.gif';
$st['items_img'][11] = 'leg_illusion9.gif';
} elseif ($nbs[4908] > 0) {
//Набор Темной Одежды
$st['items_img'][8] = 'robe_illusion2.gif';
$st['items_img'][11] = 'leg_illusion2.gif';
$st['items_img'][10] = 'boots_illusion2.gif';
$st['items_img'][9] = 'belt_illusion2.gif';
$st['items_img'][5] = 'naruchi_illusion2.gif';
$st['items_img'][4] = 'helmet_illusion2.gif';
$st['items_img'][12] = 'perchi_illusion2.gif';
} elseif ($nbs[4906] > 0) {
//Набор Бриллиантовой Одежды
$st['items_img'][8] = 'robe_illusion1.gif';
$st['items_img'][11] = 'leg_illusion1.gif';
$st['items_img'][10] = 'boots_illusion1.gif';
$st['items_img'][9] = 'belt_illusion1.gif';
$st['items_img'][5] = 'naruchi_illusion1.gif';
$st['items_img'][4] = 'helmet_illusion1.gif';
$st['items_img'][12] = 'perchi_illusion1.gif';
}
if ($nbs[4909] > 0) {
//Набор Золотых украшений
$st['items_img'][13] = 'ring_illusion2.gif';
$st['items_img'][17] = 'ring_illusion2.gif';
$st['items_img'][18] = 'ring_illusion2.gif';
$st['items_img'][14] = 'amulet_illusion2.gif';
$st['items_img'][15] = 'earrings_illusion2.gif';
} elseif ($nbs[4907] > 0) {
//Набор Золотых украшений
$st['items_img'][13] = 'ring_illusion1.gif';
$st['items_img'][17] = 'ring_illusion1.gif';
$st['items_img'][18] = 'ring_illusion1.gif';
$st['items_img'][14] = 'amulet_illusion1.gif';
$st['items_img'][15] = 'earrings_illusion1.gif';
}
if ($u['battle'] > 0) {
//Характеристики от приемов
$efs = mysql_query(
'SELECT `eu`.`id`,
`eu`.`id_eff`,
`eu`.`uid`,
`eu`.`name`,
`eu`.`data`,
`eu`.`overType`,
`eu`.`timeUse`,
`eu`.`timeAce`,
`eu`.`user_use`,
`eu`.`tr_life_user`,
`eu`.`delete`,
`eu`.`v1`,
`eu`.`v2`,
`eu`.`img2`,
`eu`.`x`,
`eu`.`hod`,
`eu`.`bj`,
`eu`.`sleeptime`,
`eu`.`no_Ace` FROM `eff_users` AS `eu` WHERE `eu`.`uid`="' . mysql_real_escape_string(
$u['id']
) . '" AND `eu`.`delete`="0" AND `eu`.`deactiveTime` < "' . time() . '" AND `eu`.`v1` = "priem" ORDER BY `eu`.`id` ASC'
);
$st['set_pog'] = [];
$st['set_pog2'] = [];
while ($e = mysql_fetch_array($efs)) {
$e['type1'] = 14;
$e['img'] = $e['img2'];
if ($e['tr_life_user'] > 0) {
$trlu = mysql_fetch_array(
mysql_query('SELECT `hpNow` FROM `stats` WHERE `id` = "' . $e['tr_life_user'] . '" LIMIT 1')
);
if (floor($trlu['hpNow']) < 1) {
$this->u->endEffect($e['id'], $u);
$st['act'] = 1;
}
}
if ($e['timeUse'] + $e['timeAce'] + $e['actionTime'] > time() || $e['timeUse'] == 77) {
if ($e['v1'] == 'priem') {
$prsu[$e['v2']] = 0 + $prsu['x'];
}
$st['effects'][$h] = $e;
$h++;
$sts = Conversion::dataStringToArray($e['data']);
if ($e['v2'] == 217) {
$st['raztac'] = 1;
}
if (isset($sts['add_pog'])) {
$ctt = count($st['set_pog']);
$st['set_pog'][$ctt]['id'] = $h;
$st['set_pog'][$ctt]['y'] = $sts['add_pog'];
unset($ctt);
}
if (isset($sts['natoe'])) {
$st['set_natoe']['id'] = $h;
$st['set_natoe']['a'] = 0 + $sts['natoe_end'];
$st['set_natoe']['b'] = 0 + $sts['natoe'];
$st['set_natoe']['eff_id'] = $e['id'];
$st['set_natoe']['t'] = 0 + $sts['natoe_type'];
$st['set_natoe']['user_id'] = $e['tr_life_user'];
}
if (isset($sts['add_pog2'])) {
$ctt = count($st['set_pog2']);
$st['set_pog2'][$ctt]['id'] = $h;
$st['set_pog2'][$ctt]['y'] = $sts['add_pog2'];
$st['set_pog2'][$ctt]['p'] = $sts['add_pog2p'];
$st['set_pog2'][$ctt]['m'] = $sts['add_pog2mp'];
unset($ctt);
}
$i = 0;
while ($i < count($ia)) {
if (isset($ia[$i]) && isset($sts['add_' . $ia[$i]])) {
if ($ia[$i] != 'zaproc' && $ia[$i] != 'zmproc') {
if (!isset($sti[$ia[$i]])) {
$sti[$ia[$i]] = 0;
}
$sti[$ia[$i]] += intval($sts['add_' . $ia[$i]]);
if (!isset($st[$ia[$i]])) {
$st[$ia[$i]] = 0;
}
$st[$ia[$i]] += intval($sts['add_' . $ia[$i]]);
} else {
$sti[$ia[$i]] = 100 - $sti[$ia[$i]];
$sti[$ia[$i]] = $sti[$ia[$i]] - $sti[$ia[$i]] / 100 * intval(
$sts['add_' . $ia[$i]]
);
$sti[$ia[$i]] = 100 - $sti[$ia[$i]];
$st[$ia[$i]] = 100 - $st[$ia[$i]];
$st[$ia[$i]] = $st[$ia[$i]] - $st[$ia[$i]] / 100 * intval($sts['add_' . $ia[$i]]);
$st[$ia[$i]] = 100 - $st[$ia[$i]];
}
}
$i++;
}
$i = 0;
while ($i < count($ia)) {
if (isset($ia[$i]) && isset($sts['add_' . $ia[$i]])) {
if (!isset($s_vi[$ia[$i]])) {
$s_vi[$ia[$i]] = 0;
}
$s_vi[$ia[$i]] += intval($sts['sv_' . $ia[$i]]);
if (!isset($s_v[$ia[$i]])) {
$s_v[$ia[$i]] = 0;
}
$s_v[$ia[$i]] += intval($sts['sv_' . $ia[$i]]);
}
$i++;
}
} else {
//удаляем эффект
$this->u->endEffect($e['id'], $u);
$st['act'] = 1;
}
}
}//Характеристики от статов
if (!isset($st['hpAll'])) {
$st['hpAll'] = 0;
}
$st['hpAll'] += $st['s4'] * 5;
if (!isset($st['mpAll'])) {
$st['mpAll'] = 0;
}
$st['mpAll'] += $st['s6'] * 10;
//Турнир
if (!isset($st['m1'])) {
$st['m1'] = 0;
}
$st['m1'] += $st['s3'] * 5;
// мф.анти-крит = 2.5
if (!isset($st['m2'])) {
$st['m2'] = 0;
}
$st['m2'] += $st['s3'] * 5;
// мф.уворот = 2.5
if (!isset($st['m4'])) {
$st['m4'] = 0;
}
$st['m4'] += $st['s2'] * 5;
// мф.анти-уворот = 2.5
if (!isset($st['m5'])) {
$st['m5'] = 0;
}
$st['m5'] += $st['s2'] * 5;
if (!isset($st['za'])) {
$st['za'] = 0;
}
$st['za'] += $st['s4'] * 1.0;
if (!isset($st['zm'])) {
$st['zm'] = 0;
}
$st['zm'] += $st['s4'] * 0.0;
if (!isset($st['zaproc'])) { //Тут зм 'zaproc'=>'Защита от урона (%)','zmproc'=>'Защита от магии стихий (%)
$st['zaproc'] = 0;
}
$st['zaproc'] += round($st['s5'] * 0);
if (!isset($st['m19'])) {
$st['m19'] = 0;
}
$st['m19'] += round($st['s3'] * 0.03);
//Мощности
//Мощность против "Мощность крит. урона". Гамс
if (!isset($st['antm3'])) {
$st['antm3'] = 0;
}
$st['antm3'] += $st['s5'] * 0.5;
if (!isset($st['m10'])) {
$st['m10'] = 0;
}
$st['m10'] += 0;
if (!isset($st['m11'])) {
$st['m11'] = 0;
}
$st['m11'] += 0;
if (!isset($st['m11a'])) {
$st['m11a'] = 0;
}
$st['m11a'] += 0;
if (!isset($st['m8'])) {
$st['m8'] = 0;
}
$st['m8'] += 0;
//Бонусы комплектов
$i = 0;
if (is_array($coms['new'])) {
while ($i <= count($coms['new'])) {
if (isset($coms['new'][$i])) {
//$coms[$i]['id'] - id комплекта, $j - кол-во предметов данного комплекта
$j = $coms['com'][$coms['new'][$i]];
$com = mysql_fetch_array(
mysql_query(
'SELECT `id`,`com`,`name`,`x`,`data` FROM `complects` WHERE `com` = "' . ((int)$coms['new'][$i]) . '" AND `x` <= ' . ((int)$j) . ' ORDER BY `x` DESC LIMIT 1'
)
);
if (isset($com['id'])) {
//добавляем действия комплекта
$ij = 0;
$sti = Conversion::dataStringToArray($com['data']);
while ($ij < count($ia)) {
if (isset($ia[$ij]) && isset($sti[$ia[$ij]])) {
$st[$ia[$ij]] += $sti[$ia[$ij]];
}
$ij++;
}
}
}
$i++;
}
}//Бонусы статов
//Замена свитков
if ($u['autospell'] != 0 && $u['battle'] == 0) {
//проверяем свитки
$splink = '';
$spi = mysql_query(
'SELECT `id`,`item_id`,`inOdet` FROM `items_users` WHERE `inOdet` >= 40 AND `inOdet` <= 50 AND `uid` = "' . $u['id'] . '" AND `delete` = 0 ORDER BY `item_id` DESC LIMIT 20'
);
while ($pli = mysql_fetch_array($spi)) {
$splink .= $pli['item_id'] . '-' . $pli['inOdet'] . ',';
}
$splink = rtrim($splink, ',');
//Запоминаем новый комплект свитков
if ($u['autospell'] == 1) {
$u['autospell'] = $splink;
mysql_query(
'UPDATE `users` SET `autospell` = "' . $splink . '" WHERE `id` = "' . $u['id'] . '" LIMIT 1'
);
}
//Выдаем нужный свиток, если он есть в инвентаре
if ($u['autospell'] != $splink) {
$spe1 = explode(',', $splink);
$spe2 = explode(',', $u['autospell']);
$i = 0;
while ($i <= 20) {
//
$spe1a = explode('-', $spe1[$i]);
$spe2a = explode('-', $spe2[$i]);
//
if (isset($spe1a[0])) {
$spe1g[$spe1a[1]] = $spe1a[0];
}
if (isset($spe2a[0])) {
$spe2g[$spe2a[1]] = $spe2a[0];
}
//
$i++;
}
for ($i = 40; $i <= 50; $i++) {
if ($spe1g[$i] == $spe2g[$i] || $spe1g[$i] != 0) {
continue;
}
Db::sql('update items_users set inOdet = ? where inOdet = 0 and `delete` = 0 and inTransfer = 0 and inShop = 0 and inGroup = 0 and item_id = ? and uid = ?',
[$i, $spe2g[$i], $u['id']]);
}
}
}//Бонусы статов
//ТУТ
//сила
if ($st['s1'] > 24 && $st['s1'] < 50) {
$st['m2'] += 15;
}
if ($st['s1'] > 49 && $st['s1'] < 75) {
$st['pa2'] += 2;
$st['m2'] += 35;
}
if ($st['s1'] > 74 && $st['s1'] < 100) {
$st['pa2'] += 5;
$st['m2'] += 50;
}
if ($st['s1'] > 99 && $st['s1'] < 125) {
$st['pa2'] += 8;
$st['m2'] += 80;
}
if ($st['s1'] > 124 && $st['s1'] < 150) {
$st['pa2'] += 12;
$st['m2'] += 105;
}
if ($st['s1'] > 149 && $st['s1'] < 175) {
$st['pa2'] += 17;
$st['m7'] += 2;
}
if ($st['s1'] > 174 && $st['s1'] < 200) {
$st['pa2'] += 23;
$st['m7'] += 5;
}
if ($st['s1'] > 199) {
$st['pa2'] += 30;
$st['m7'] += 7;
}
if ($st['s2'] > 24 && $st['s2'] < 50) {
$st['pa1'] += 2;
$st['m4'] += 35;
}
if ($st['s2'] > 49 && $st['s2'] < 75) {
$st['pa1'] += 5;
$st['m2'] += 40;
$st['m4'] += 75;
}
if ($st['s2'] > 74 && $st['s2'] < 100) {
$st['pa1'] += 8;
$st['m2'] += 65;
$st['m4'] += 90;
}
if ($st['s2'] > 99 && $st['s2'] < 125) {
$st['pa1'] += 12;
$st['m2'] += 75;
$st['m4'] += 105;
}
if ($st['s2'] > 124 && $st['s2'] < 150) {
$st['pa1'] += 17;
$st['m2'] += 85;
$st['m4'] += 105;
$st['m15'] += 1;
}
if ($st['s2'] > 149 && $st['s2'] < 175) {
$st['pa1'] += 20;
$st['m2'] += 110;
$st['m4'] += 115;
$st['m15'] += 2;
}
if ($st['s2'] > 174 && $st['s2'] < 200) {
$st['pa1'] += 23;
$st['m2'] += 145;
$st['m4'] += 145;
$st['m15'] += 3;
}
if ($st['s2'] > 199) {
$st['pa1'] += 30;
$st['m2'] += 165;
$st['m4'] += 165;
$st['m15'] += 5;
}//интуиция
if ($st['s3'] > 24 && $st['s3'] < 50) {
$st['pa4'] += 2;
$st['m3'] += 2;
$st['m1'] += 25;
}
if ($st['s3'] > 49 && $st['s3'] < 75) {
$st['pa4'] += 5;
$st['m3'] += 5;
$st['m1'] += 55;
}
if ($st['s3'] > 74 && $st['s3'] < 100) {
$st['pa4'] += 8;
$st['m3'] += 10;
$st['m1'] += 75;
$st['m5'] += 25;
}
if ($st['s3'] > 99 && $st['s3'] < 125) {
$st['pa4'] += 12;
$st['m3'] += 15;
$st['m1'] += 105;
$st['m5'] += 35;
}
if ($st['s3'] > 124 && $st['s3'] < 150) {
$st['pa4'] += 17;
$st['m3'] += 20;
$st['m1'] += 125;
$st['m5'] += 45;
$st['m14'] += 1;
}
if ($st['s3'] > 149 && $st['s3'] < 175) {
$st['pa4'] += 20;
$st['m3'] += 30;
$st['m1'] += 145;
$st['m5'] += 50;
$st['m14'] += 2;
}
if ($st['s3'] > 174 && $st['s3'] < 200) {
$st['pa4'] += 23;
$st['m3'] += 35;
$st['m1'] += 165;
$st['m5'] += 55;
$st['m14'] += 3;
}
if ($st['s3'] > 199) {
$st['pa4'] += 30;
$st['m3'] += 40;
$st['m1'] += 185;
$st['m5'] += 65;
$st['m14'] += 5;
}//выносливость
if ($st['s4'] > 0) {
$st['hpAll'] += 30;
}
if ($st['s4'] > 24 && $st['s4'] < 50) {
$st['hpAll'] += 50;
}
if ($st['s4'] > 49 && $st['s4'] < 75) {
$st['hpAll'] += 100;
}
if ($st['s4'] > 74 && $st['s4'] < 100) {
$st['hpAll'] += 175;
$st['m19'] += 2;
}
if ($st['s4'] > 99 && $st['s4'] < 125) {
$st['hpAll'] += 250;
$st['m19'] += 4;
}
if ($st['s4'] > 124 && $st['s4'] < 150) {
$st['hpAll'] += 400;
$st['za'] += 25;
$st['zm'] += 25;
}
if ($st['s4'] > 149 && $st['s4'] < 175) {
$st['hpAll'] += 450;
$st['za'] += 50;
$st['zm'] += 50;
}
if ($st['s4'] > 174 && $st['s4'] < 200) {
$st['hpAll'] += 600;
$st['za'] += 100;
$st['zm'] += 100;
}
if ($st['s4'] > 199) {
$st['hpAll'] += 850;
$st['za'] += 125;
$st['zm'] += 125;
}//интелект
if ($st['s5'] > 24 && $st['s5'] < 50) {
$st['m11'] += 10;
}
if ($st['s5'] > 49 && $st['s5'] < 75) {
$st['m11'] += 15;
}
if ($st['s5'] > 74 && $st['s5'] < 100) {
$st['m11'] += 20;
}
if ($st['s5'] > 99 && $st['s5'] < 125) {
$st['m11'] += 25;
}
if ($st['s5'] > 124 && $st['s5'] < 150) {
$st['m11'] += 35;
}
if ($st['s5'] > 149 && $st['s5'] < 175) {
$st['m11'] += 50;
}
if ($st['s5'] > 174) {
$st['m11'] += 65;
$st['pzm'] += 2;
}
if ($st['s5'] > 199) {
$st['pzm'] += 5;
}//мудрость
if ($st['s6'] > 24 && $st['s6'] < 50) {
$st['mpAll'] += 150;
$st['speedmp'] += 100;
}
if ($st['s6'] > 49 && $st['s6'] < 75) {
$st['mpAll'] += 200;
$st['speedmp'] += 200;
}
if ($st['s6'] > 74 && $st['s6'] < 100) {
$st['mpAll'] += 250;
$st['speedmp'] += 350;
}
if ($st['s6'] > 99 && $st['s6'] < 125) {
$st['mpAll'] += 350;
$st['speedmp'] += 500;
}
if ($st['s6'] > 124 && $st['s6'] < 150) {
$st['mpAll'] += 500;
$st['speedmp'] += 500;
$st['pzm'] += 2;
}
if ($st['s6'] > 149 && $st['s6'] < 175) {
$st['mpAll'] += 700;
$st['speedmp'] += 600;
$st['pzm'] += 3;
}
if ($st['s6'] > 174 && $st['s6'] < 200) {
$st['mpAll'] += 900;
$st['speedmp'] += 700;
$st['pzm'] += 5;
}
if ($st['s6'] > 199) {
$st['mpAll'] += 900;
$st['speedmp'] += 700;
$st['pzm'] += 7;
}//если второе оружие одето
if ($hnd2 == 1 && $hnd1 == 1) {
$st['zona']++;
}
if ($sht1 == 1) {
$st['zonb']++;
}/* Владения */
$i = 1;
while ($i <= 7) {
if (!isset($st['pm' . $i])) {
$st['pm' . $i] = 0;
}
if (!isset($st['a' . $i])) {
$st['a' . $i] = 0;
}
if (!isset($st['mg' . $i])) {
$st['mg' . $i] = 0;
}
if (!isset($st['zm' . $i])) {
$st['zm' . $i] = 0;
}
if (isset($st['s5'])) {
$st['pm' . $i] += $st['s5'] * 0.5;
}
if (isset($st['m11a'])) {
$st['pm' . $i] += $st['m11a'];
}
if (isset($st['aall'])) {
$st['a' . $i] += $st['aall'];
}
if (isset($st['m2all'])) {
$st['mg' . $i] += $st['m2all'];
}
if (isset($st['zm'])) {
$st['zm' . $i] += $st['zm'];
}
if (isset($st['zma'])) {
$st['zm' . $i] += $st['zma'];
}
if ($i <= 4) {
if (!isset($st['mib' . $i])) {
$st['mib' . $i] = 0;
}
if (!isset($st['mab' . $i])) {
$st['mab' . $i] = 0;
}
if (!isset($st['mg' . $i])) {
$st['mg' . $i] = 0;
}
if (!isset($st['pm' . $i])) {
$st['pm' . $i] = 0;
}
if (!isset($st['pa' . $i])) {
$st['pa' . $i] = 0;
}
if (!isset($st['za' . $i])) {
$st['za' . $i] = 0;
}
$st['mib' . $i] += 0;
$st['mab' . $i] += 0;
if (isset($st['mall'])) {
$st['mg' . $i] += $st['mall'];
}
if (isset($st['m11'])) {
$st['pm' . $i] += $st['m11'];
}
if (isset($st['m10'])) {
$st['pa' . $i] += $st['m10'];
}
if (isset($st['za'])) {
$st['za' . $i] += $st['za'];
}
}
$i++;
}//Уязвимость оружие и магиям
$i = 1;
while ($i <= 7) {
$st['yzm' . $i] += $st['yzma'];
if ($i <= 4) {
$st['yzm' . $i] += $st['yzm'];//стихийный урон только
$st['yza' . $i] += $st['yza']; //урон оружия
}
//Отнимает от защиты от урона
if (isset($st['yza' . $i]) && $i <= 4) {
$st['za' . $i] = ($st['za' . $i] / 100 * (100 + ($st['yza' . $i])));
if ($st['za' . $i] < 0) {
$st['za' . $i] = 0;
}
}
//Отнимает от защиты от магии
if (isset($st['yzm' . $i])) {
$st['zm' . $i] = ($st['zm' . $i] / 100 * (100 + ($st['yzm' . $i])));
if ($st['zm' . $i] < 0) {
$st['zm' . $i] = 0;
}
}
$i++;
}
if (isset($st['hpVinos']) && $st['hpVinos'] != 0) {
$st['hpAll'] += round($st['hpVinos'] * $st['s4']);
}
if (isset($st['mpVinos']) && $st['mpVinos'] != 0) {
$st['mpAll'] += round($st['mpVinos'] * $st['s6']);
}
if (isset($st['hpProc']) && $st['hpProc'] != 0) {
$st['hpAll'] += round($st['hpAll'] / 100 * $st['hpProc']);
}
if (isset($st['mpProc']) && $st['mpProc'] != 0) {
$st['mpAll'] += round($st['mpAll'] / 100 * $st['mpProc']);
}//Реген. - 250 ед.
//конец бонусов
if ($st['hpNow'] < 0) {
$st['hpNow'] = 0;
} elseif ($st['hpNow'] > $st['hpAll']) {
$st['hpNow'] = $st['hpAll'];
}
if ($st['mpNow'] < 0) {
$st['mpNow'] = 0;
} elseif ($st['mpNow'] > $st['mpAll']) {
$st['mpNow'] = $st['mpAll'];
}//зоны блока и удара
if ($st['zona'] < 1) {
$st['zona'] = 1;
}
if ($st['zona'] > 5) {
$st['zona'] = 5;
}
if ($st['zonb'] < 1) {
$st['zonb'] = 1;
}
if ($st['zonb'] > 3) {
$st['zonb'] = 3;
}
$st['ozash'] = $oza;
$st['ozmsh'] = $ozm;
$st['weapon1'] = $hnd1;
$st['weapon2'] = $hnd2;
$st['sheld1'] = $sht1;
$st['sv_'] = $s_v;
$st['sv_i'] = $s_vi;
$st['dom'] = $dom;
$st['prsu'] = $prsu;
$st['x'] = $u['x'];
$st['y'] = $u['y'];
$st['s'] = $u['s'];
$st['reting'] = 1 + ceil($st['reting']);
if ($st['vip'] > 0) { //$u
$st['antm3'] += 20;
$st['zaproc'] += 5;
$st['zmproc'] += 5;
$st['m10'] += 20;
$st['pzm'] += 5;
}
//Бонус от медалей
$rep1 = mysql_fetch_array(
mysql_query(
'SELECT
`add_slot`,`nu_sandcity`,`n_sandcity`,
`dl1`,`id`,`rep1`,`repcapitalcity`,`repdemonscity`,`repangelscity`,`repabandonedplain`,
`repdevilscity`,`repmooncity`,`repsuncity`,`repsandcity`,`repemeraldscity`,`repdreamscity`,`repizlom`,
`n_capitalcity`,`n_demonscity`,`n_suncity`,`nu_demonscity`,`nu_angelscity`,`nu_abandonedplain`,`nu_emeraldscity`,
`nu_capitalcity`,`nu_suncity`,`nu_devilscity`,`nu_dreamscity`,`add_stats`,`add_money`,`add_skills`,`add_skills2`,
`rep3`,`rep3_buy`,`repdragonscity`,`n_dragonscity`,`nu_dragonscity`,
(`repcapitalcity`+`repdemonscity`+`repangelscity`+`repsuncity`+`repdreamscity`+`repabandonedplain`+`repsandcity`+`repemeraldscity`+`repdevilscity`) as allrep,
(`nu_capitalcity`+`nu_demonscity`+`nu_angelscity`+`nu_suncity`+`nu_dreamscity`+`nu_abandonedplain`+`nu_sandcity`+`nu_emeraldscity`+`nu_devilscity`) as allnurep FROM `rep` WHERE `id` = "' . $u['id'] . '" LIMIT 1'
)
);
if ($u['referals'] >= 3000) {
$st['speedhp'] += 50;
$st['speedmp'] += 50;
$st['antm3'] += 25;
$st['m10'] += 15;
$st['m11'] += 15;
$st['speed_dungeon'] += 25;
$st['hpAll'] += 250;
}//Водосток
if ($rep1['repdreamscity'] >= 24999) {
$st['m10'] += 10;
$st['pzm'] += 1;
}//излом
if ($rep1['repizlom'] == 9999) {
$st['m10'] += 10;
$st['pzm'] += 1;
}//Бездна
if ($rep1['repangelscity'] == 25000) {
$st['m10'] += 10;
$st['pzm'] += 1;
}//Катакомбы
if ($rep1['repdemonscity'] == 25000) {
$st['m10'] += 10;
$st['pzm'] += 1;
}//Грибница
if ($rep1['repdemonscity'] == 25000) {
$st['m10'] += 10;
$st['pzm'] += 1;
}//Пещера тысячи проклятий
if ($rep1['repcapitalcity'] == 25000) {
$st['m10'] += 10;
$st['pzm'] += 1;
}//Санд
if ($rep1['repsandcity'] == 25000) {
$st['m10'] += 10;
$st['pzm'] += 1;
}//Гора легиона
if ($rep1['repabandonedplain'] == 24999) {
$st['m10'] += 10;
$st['pzm'] += 1;
}//Добавочный подьем для игроков
$st['maxves'] += 500;
if ($u['admin'] > 0) { // ускоренная регенерация и пробег по подземелью
$st['speed_dungeon'] = 10000;
$st['speedhp'] = 10000;
if ($u['battle']) {
Db::sql("update stats set
tactic1 = tactic2 = tactic3 = tactic4 = tactic5 = tactic6 = tactic7 = 25,
priems_z = '0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|'
where id = ?", [$u['id']]);
}
}
if (date('H') >= 22 && date('H') <= 10) {
$st['exp'] += 25;
}//Сохраняем рейтинг игрока
$st['reting'] = floor($st['reting']);
if (isset($st['btl_cof'], $st['prckr']) && $st['btl_cof'] != $st['prckr']) {
$st['btl_cof'] = $st['prckr'];
Db::sql('update stats set btl_cof = ? where id = ?', [$st['prckr'], $st['id']]);
}
if ($st['hpAll'] < 1) {
$st['hpAll'] = 1;
}
if ($st['mpAll'] < 0) {
$st['mpAll'] = 0;
}
if (stristr($u['login'], '(зверь ') || (stristr($u['login'], 'Каменный страж') && $u['ip'] == '0')) {
$st['this_animal'] = 1;
} else {
$st['this_animal'] = 0;
}
$rt = [];
if ($i1 == 1) {
$rt[0] = $st;
$rt[1] = $st2; //родные статы
} else {
$rt = $st;
}
if ($u['hpAll'] != $st['hpAll'] || $u['mpAll'] != $st['mpAll']) {
mysql_query(
'UPDATE `stats` SET `hpAll` = "' . $st['hpAll'] . '",`mpAll` = "' . $st['mpAll'] . '" WHERE `id` = "' . $u['id'] . '" LIMIT 1'
);
}
if ($btl_cache) {
$dataca = [
'st' => $st,
'st2' => $st2,
];
$dataca = json_encode($dataca);
mysql_query(
'INSERT INTO `battle_cache` (`uid`,`battle`,`data`,`time`) VALUES ("' . $u['id'] . '","' . $u['battle'] . '","' . mysql_real_escape_string(
$dataca
) . '","' . time() . '")'
);
}
return $rt;
}
}