diff --git a/_incl_data/class/User.php b/_incl_data/class/User.php index 8fb77c92..4a9674f4 100644 --- a/_incl_data/class/User.php +++ b/_incl_data/class/User.php @@ -1121,7 +1121,6 @@ class User private function infoTasks() { if (empty($this->info)) { - //trigger_error('user->info is empty in constructor', E_USER_WARNING); return; } @@ -1264,24 +1263,14 @@ class User } if ($u['admin'] > 0) { - - mysql_query( - 'UPDATE `stats` SET - `tactic1` = 25, - `tactic2` = 25, - `tactic3` = 25, - `tactic4` = 25, - `tactic5` = 25, - `tactic6` = 25, - `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'] . '" LIMIT 1 - ' - ); + 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 ($this->info['id'] == $u['id'] || $reimg != false) { + if ($this->info['id'] == $u['id'] || $reimg) { $sp_img = mysql_query( 'SELECT * FROM `items_img` WHERE `uid` = "' . $u['id'] . '" AND `img_id` != "0" LIMIT 16' ); @@ -2121,7 +2110,6 @@ class User $i = 40; while ($i <= 50) { if ($spe1g[$i] != $spe2g[$i] && $spe1g[$i] == 0) { - //echo '['.$spe2g[$i].'->'.$i.']'; $splu = mysql_fetch_array( mysql_query( 'SELECT * FROM `items_users` WHERE `item_id` = "' . $spe2g[$i] . '" AND `inOdet` = 0 AND `delete` = 0 AND `inTransfer` = 0 AND `inShop` = 0 AND `uid` = "' . $u['id'] . '" AND `inGroup` = 0 LIMIT 1' @@ -2810,6 +2798,8 @@ class User } } + //Удаление определенного типа предметов + public function testAction($filter, $tp) { if ($tp == 1) { @@ -2822,74 +2812,11 @@ class User return $stmt ? mysql_fetch_array($stmt) : []; } - //Удаление определенного типа предметов - public function getUserInfoById($id) { return Db::getRow('select * from users left join stats on users.id = stats.id where users.id = ?', [$id]); } - private function infoTasks() - { - if (empty($this->info)) { - //trigger_error('user->info is empty in constructor', E_USER_WARNING); - return; - } - - $this->getStats($this->info); // Бля, а вдруг? - - $this->info['achiv'] = Db::getRow('select * from users_achiv where id = ?', [$this->info['id']]); - if (!isset($this->info['achiv']['id'])) { - Db::sql('insert into users_achiv (id) value (?)', [$this->info['id']]); - $this->info['achiv'] = Db::getRow('select * from users_achiv where id = ?', [$this->info['id']]); - } - - if (isset($this->info['id']) && $this->info['exp'] > 300000 && $this->info['twink'] > 0) { - $this->info['exp'] = 300000; - Db::sql('update stats set exp = ? where id = ?', [$this->info['exp'], $this->info['id']]); - } - - if (isset($this->info['id']) && $this->info['inUser']) { - $md = [ - $this->info['molch1'], - $this->info['molch2'], - $this->info['molch3'], - $this->info['admin'], - $this->info['nadmin'], - $this->info['banned'], - $this->info['align'], - $this->info['id'], - $this->info['level'], - ]; - - $this->info = $this->getUserInfoById($this->info['inUser']); - - if ($this->info['molch1'] < $md[0]) { - $this->info['molch1'] = $md[0]; - } - if ($this->info['molch2'] < $md[1]) { - $this->info['molch2'] = $md[1]; - } - if ($this->info['molch3'] < $md[2]) { - $this->info['molch3'] = $md[2]; - } - if ($this->info['admin'] < $md[3]) { - $this->info['admin'] = $md[3]; - } - if ($this->info['nadmin'] < $md[4]) { - $this->info['nadmin'] = $md[4]; - } - if ($this->info['banned'] < $md[5]) { - $this->info['banned'] = $md[5]; - } - - $this->info['noreal'] = 1; - $this->info['align_real'] = $md[7]; - $this->info['__id'] = $md[8]; - $this->info['__level'] = $md[9]; - } - } - public function addAction($time, $vars, $vls, $uid = null): bool { $info = $this->info; @@ -2902,34 +2829,6 @@ class User //Выводим вещи котоыре нужно отремонтировать - public function testHome(): array - { - /*----Быстрый(Особенность)----*/ - $timeforwait = 3600; - if (isset($st['os3']) && $st['os3'] > 0) { - $timeforwait = 3600 - (($st['os6'] * 5) * 60); - } - /*----Быстрый(Особенность)----*/ - $hgo = $this->testAction( - '`uid` = "' . $this->info['id'] . '" AND `time` >= ' . (time() - $timeforwait) . ' AND `vars` = "go_homeworld" LIMIT 1', - 1 - ); - if ($this->info['level'] == 0 || $this->info['active'] != '' || $this->info['inTurnir'] > 0 || $this->info['inTurnirnew'] > 0 || $this->info['zv'] > 0 || $this->info['dnow'] > 0) { - $hgo['id'] = true; - } - if (isset($this->info['noreal']) || $this->info['dnow'] > 0) { - $hgo['id'] = true; - } - if (!isset($hgo['id'])) { - $ku = mysql_fetch_array( - mysql_query('SELECT `id` FROM `katok_zv` WHERE `uid` = ' . $this->info['id']) - ); - if (isset($ku['id'])) { - $hgo['id'] = true; - } - } - return $hgo ?? []; - } //Расчет урона от оружия @@ -3090,16 +2989,6 @@ class User return self::$flag_one; } - /** Singletone. - * @return User - */ - public static function start(): User - { - if (!isset(self::$flag_one)) { - self::$flag_one = new self(); - } - return self::$flag_one; - } public static function setOnline(int $uid): void { @@ -3236,16 +3125,6 @@ class User return ConversionHelper::secondsToTimeout($ttm); } - /** - * @param $ttm - * @return string - * @deprecated использовать ConversionHelper::secondsToTimeout() - */ - public function timeOut($ttm): string - { - return ConversionHelper::secondsToTimeout($ttm); - } - public function insertAlign($an, $uid) { if ($an > 0) { @@ -3629,110 +3508,6 @@ class User return $tp; } - private function weaponAtc($item, $st, $x) - { - $tp = 0; - if (isset($item['id'])) { - $itm = ConversionHelper::dataStringToArray($item['data']); - //начинаем расчет урона - if (!isset($st['minAtack'])) { - $st['minAtack'] = 0; - } - if (!isset($st['maxAtack'])) { - $st['maxAtack'] = 0; - } - if (!isset($st['yron_min'])) { - $st['yron_min'] = 0; - } - if (!isset($st['yron_max'])) { - $st['yron_max'] = 0; - } - if (!isset($itm['yron_min'])) { - $itm['yron_min'] = 0; - } - if (!isset($itm['yron_max'])) { - $itm['yron_max'] = 0; - } - if (!isset($itm['sv_yron_min'])) { - $itm['sv_yron_min'] = 0; - } - if (!isset($itm['sv_yron_max'])) { - $itm['sv_yron_max'] = 0; - } - - $min = $itm['sv_yron_min'] + $st['minAtack'] + $itm['yron_min'] + $st['yron_min']; - $max = $itm['sv_yron_max'] + $st['maxAtack'] + $itm['yron_max'] + $st['yron_max']; - - //Тип урона: 0 - нет урона, 1 - колющий, 2 - рубящий, 3 - дробящий, 4 - режущий, 5 - огонь, 6 - воздух, 7 - вода, 8 - земля, 9 - свет, 10 - тьма, 11 - серая - if ($item['type'] == 18) { - //колющий - $sss = ceil($st['s2'] * 0.75); - } elseif ($item['type'] == 19) { - //рубящий - $sss = ceil($st['s1'] * 0.75); - } elseif ($item['type'] == 20) { - //дробящий - $sss = ceil($st['s4'] * 1.5); - } elseif ($item['type'] == 21) { - //режущий - $sss = ceil($st['s3'] * 0.75); - } else { - //без профильного урона - $sss = ceil($st['s1'] * 0.1); - } - - //Обычный урон - - $p['B'][0] = ceil($st['s1'] * 1); - $p['B'][1] = ceil(0.4 + $p['B'][0] / 0.9); - - $p['B'][0] = 2 + $st['level'] + $st['s1'] - round($st['s1'] / 5); - $p['B'][1] = $p['B'][0] + 3; - - $p['B']['rnd'] = rand($p['B'][0], $p['B'][1]); - //Добавочный минимальный урон - $p['W'][0] = $min; - $p['W'][1] = $max; - $p['W']['rnd'] = rand($p['W'][0], $p['W'][1]); - // Коэф. оружия - $p['T'] = 1; - //Владения - $bn = 0; - if ($item['type'] == 21) { - // меч - $p['M'] = $st['pa4']; - $bn = $st['a4']; - //ТУТ $p['M'] = $st['pa'.$x]; - } elseif ($item['type'] == 20) { - // дубина - $p['M'] = $st['pa3']; - $bn = $st['a3']; - } elseif ($item['type'] == 19) { - // топор - $p['M'] = $st['pa2']; - $bn = $st['a2']; - } elseif ($item['type'] == 18) { - // нож - $p['M'] = $st['pa1']; - $bn = $st['pa1']; - } elseif ($item['type'] == 22) { - // посох - $p['M'] = $st['pa3']; - $bn = $st['a5']; - } - //Мощнность - - $min = (($p['B'][0] + $sss + $p['W'][0]) * $p['T'] * (1 + 0.005 * $bn)) * (1 + $p['M'] / 100); - $max = (($p['B'][1] + $sss + $p['W'][1]) * $p['T'] * (1 + 0.005 * $bn)) * (1 + $p['M'] / 100); - // - $kmin = ceil((2 * (1 + $st['m3'] / 100)) * $min); - $kmax = ceil((2 * (1 + $st['m3'] / 100)) * $max); - - $tp = [0 => ceil($min), 1 => ceil($max), 2 => ceil($kmin), 3 => ceil($kmax)]; - } - return $tp; - } - //Удаление определенного типа предметов public function rep_zv(int $id, int $e): string @@ -3870,522 +3645,10 @@ class User //Расчет урона от оружия - private function microLogin2(array $userInfo): string - { - $result = ''; - if ($userInfo['align'] > 0) { - $result .= ''; - } - if ($userInfo['clan'] > 0) { - $result .= '' . $userInfo['clanName'] . ''; - } - $result .= '' . $userInfo['login'] . '[' . $userInfo['level'] . ']'; - if ($userInfo['login'] !== 'невидимка') { - $result .= ''; - } - return $result; - } - //Расчет защиты - public function addKr($amount) - { - Db::sql('update users set money = money + ? where id = ?', [$amount, $this->info['id']]); - } - //Расчет защиты (магия) - public function microLogin(int $id, int $t = 1, int $nnz = 1): string - { - if ($t !== 1) { - $inf['id'] = $id; - } else { - $inf = Db::getRow( - 'select - users.id, - if(invis = 1 or invis < unix_timestamp(), login, ?) as login, - if(invis = 1 or invis < unix_timestamp(), users.align, 0) as align, - if(status > 0, clan, 0) as clan, - if(invis = 1 or invis < unix_timestamp(), users.level, ?) as level, - if(status > 0, clan.name, ?) as clanName - from users left join clan on clan.id = users.clan and status > 0 where users.id = ?', - ['невидимка', '??', '', $id] - ); - } - return isset($inf['id']) ? $this->microLogin2($inf) : ''; - } - - public function dayquest(int $id): string - { - $test = Db::getRow('select id, vals from actions where uid = ? and vars = ?', [$id, 'day_quest']); - $q = [ - '1' => 'Убийство Трупожоров', - '2' => 'Победы в хаотических боях', - '3' => 'Спуск в Подземелия', - '4' => 'Набрать в хаотических поединках 100 000 Опыта', - '5' => 'Открыть Сундук Трупожора', - '6' => 'Посетить Излом Хаоса', - '7' => 'Сдача 3 заданий в пещерах', - '8' => 'Поучаствовать в Башне Смерти', - ]; - if (!isset($test['id'])) { - $n = "Получить задание"; - } else { - $n = "Сдать задание"; - $n = $n . "
" . $q[$test['vals']] . ""; - } - return $n; - } - - public function testAlign($an, int $uid): int - { - $r = 1; - if (floor($an) > 0) { - $a = Db::getValue( - 'select align from users_align where uid = ? and (`delete` = 0 or `delete` > unix_timestamp())', - [$uid] - ); - - if (floor((float)$a['align']) != $an) { - $r = 0; - } - } - return $r; - } - - public function abilsRoom(string $type): string - { - $r = ''; - // - if ($this->info['clan'] > 0 || !in_array($this->room['name'], ['Зал Света', 'Зал Нейтралов', 'Зал Тьмы'])) { - //Нельзя использовать персонажам в клане - return ''; - } - if ($type == 'test') { - if (isset($_GET['vhp'])) { - $v = Db::getValue('select time from vortex where uid = ? and type = 1 order by time desc limit 1'); - if ($v > time() - 60 * 60) { - //Уже юзали - $this->error = 'Необходимо подождать еще ' . ConversionHelper::secondsToTimeout($v + 60 * 60 - time()); - } else { - if ($this->stats['hpNow'] < 1) { - $this->stats['hpNow'] = 0; - } - $this->error = 'Вы успешно восстановили ' . round($this->stats['hpAll'] - $this->stats['hpNow']) . ' HP.'; - Db::sql( - 'insert into vortex (uid, room, time, val, type) VALUES (?,?,unix_timestamp(),?,1)', - [$this->info['id'], $this->info['room'], round($this->stats['hpAll'] - $this->stats['hpNow'])] - ); - $this->stats['hpNow'] = $this->stats['hpAll']; - Db::sql('update stats set hpNow = ? where id = ?', [$this->stats['hpNow'], $this->info['id']]); - } - } elseif (isset($_GET['vmp'])) { - $v = Db::getValue('select time from vortex where uid = ? and type = 2 order by time desc limit 1'); - if ($v > time() - 60 * 60) { - //Уже юзали - $this->error = 'Необходимо подождать еще ' . ConversionHelper::secondsToTimeout($v + 60 * 60 - time()); - } else { - if ($this->stats['mpNow'] < 1) { - $this->stats['mpNow'] = 0; - } - $this->error = 'Вы успешно восстановили ' . round($this->stats['mpAll'] - $this->stats['mpNow']) . ' MP.'; - Db::sql( - 'insert into vortex (uid, room, time, val, type) VALUES (?,?,unix_timestamp(),?,2)', - [$this->info['id'], $this->info['room'], round($this->stats['mpAll'] - $this->stats['mpNow'])] - ); - $this->stats['mpNow'] = $this->stats['mpAll']; - Db::sql('update stats set mpNow = ? where id = ?', [$this->stats['mpNow'], $this->info['id']]); - } - } - - } elseif ($type == 'look') { - $vid = 0; - if ($this->room['name'] == 'Зал Света') { - $vid = 6; - } elseif ($this->room['name'] == 'Зал Тьмы') { - $vid = 7; - } elseif ($this->room['name'] == 'Зал Нейтралов') { - $vid = 10; - } - $v = mysql_fetch_array( - mysql_query( - 'SELECT * FROM `vortex` WHERE `uid` = "' . $this->info['id'] . '" AND `type` = 1 ORDER BY `time` DESC LIMIT 1' - ) - ); - if (isset($v['id']) && $v['time'] + 60 * 60 > time()) { - $r .= ' '; - } else { - $r .= ' '; - } - $v = mysql_fetch_array( - mysql_query( - 'SELECT * FROM `vortex` WHERE `uid` = "' . $this->info['id'] . '" AND `type` = 2 ORDER BY `time` DESC LIMIT 1' - ) - ); - if (isset($v['id']) && $v['time'] + 60 * 60 > time()) { - $r .= ' '; - } else { - $r .= ' '; - } - } - return $r; - } - - public function insertAlign($an, $uid) - { - if ($an > 0) { - mysql_query( - 'UPDATE `users_align` SET `delete` = "' . (time() + 1) . '" WHERE `uid` = "' . mysql_real_escape_string( - $uid - ) . '" AND `align` = "' . mysql_real_escape_string(floor($an)) . '"' - ); - mysql_query( - 'INSERT INTO `users_align` (`uid`,`time`,`delete`,`align`) VALUES ( - "' . mysql_real_escape_string($uid) . '","' . time() . '","0","' . mysql_real_escape_string( - floor($an) - ) . '" - ) ' - ); - } - } - - public function deleteAlign($an, $uid) - { - if ($an > 0) { - mysql_query( - 'UPDATE `users_align` SET `delete` = "' . (time() + 86400 * 60) . '" WHERE `uid` = "' . mysql_real_escape_string( - $uid - ) . '" AND `align` = "' . mysql_real_escape_string(floor($an)) . '"' - ); - } - } - - public function repobmen($id, $type) - { - //echo 'обмен'; - $pl = mysql_fetch_array( - mysql_query( - 'SELECT `im`.*,`iu`.* FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.`item_id`) WHERE `iu`.`uid`="' . $this->info['id'] . '" AND `iu`.`delete`="0" AND `iu`.`inOdet`="0" AND `iu`.`inShop`="0" AND `iu`.`id` = "' . ((int)$id) . '" LIMIT 1;' - ) - ); - $po = ConversionHelper::dataStringToArray($pl['data']); - if ((!isset($po['frompisher']) || $po['tr_lvl'] < 4) && $pl['type'] != 31) { - $e = 'Не удалось обменять предмет на репутацию.'; - } else { - $e = 'Обмен предмета "' . $pl['name'] . '" на репутацию Сapitalcity прошел удачно.'; - mysql_query( - 'UPDATE `items_users` SET `delete` = "' . time() . '" WHERE `id` = "' . $pl['id'] . '" LIMIT 1' - ); - $this->rep['repcapitalcity'] += 1; - mysql_query( - 'UPDATE `rep` SET `repcapitalcity` = "' . $this->rep['repcapitalcity'] . '" WHERE `id` = "' . $this->info['id'] . '" LIMIT 1' - ); - } - return $e; - } - - public function lookKeys($m, $i): array - { - - $e = explode('|', $m); - $r = []; - while ($i < count($e)) { - $j = explode('=', $e[$i]); - $r[$i] = $j[0]; - $i++; - } - return $r; - } - - public function zago($v): float - { - if ($v > 1700) { - $v = 1700; - } - return round((1 - (pow(0.5, ($v / 399.51)))) * 100, 2); - } - - public function zmgo($v) - { - if ($v > 1000) { - $v = 1000; - } - return (1 - (pow(0.5, ($v / 250)))) * 100; - } - - public function inform(string $v) - { - $r = ''; - $y = []; - $w1 = 0; - $w2 = 0; - $i = 0; - if ($v == 'yrontest' || $v == 'yrontest-krit') { - /* первое оружие или кулак */ - if (is_array($this->stats['items'])) { - while ($i < count($this->stats['items'])) { - if ($this->stats['items'][$i]['inOdet'] == 3 && $w1 == 0 && $this->stats['items'][$i]['type'] >= 18 && $this->stats['items'][$i]['type'] <= 28) { - $w1 = $this->stats['items'][$i]; - } elseif ($this->stats['items'][$i]['inOdet'] == 14 && $w2 == 0 && $this->stats['items'][$i]['type'] >= 18 && $this->stats['items'][$i]['type'] <= 28) { - $w2 = $this->stats['items'][$i]; - } - $i++; - } - } - if (isset($w1['id']) && $w1['inOdet'] != 14) { - $tp = 0; - $t = 0; - $i = 1; - $d = ConversionHelper::dataStringToArray($w1['data']); - while ($i <= 4) { - if (isset($d['tya' . $i]) && $t < $d['tya' . $i]) { - $t = $d['tya' . $i]; - $tp = $i; - } - $i++; - } - $y = $this->weaponAtc($w1, $this->stats, $tp); - if ($v == 'yrontest-krit') { - $y[0] = $y[2]; - $y[1] = $y[3]; - } - if ($y[0] < 1) { - $y[0] = 1; - } - if ($y[1] < 1) { - $y[1] = 1; - } - $r .= '' . $y[0] . '-' . $y[1] . ''; - } else { - //урон кулаком - $y[0] = ceil( - 2 + $this->info['level'] + $this->stats ['s1'] - round($this->stats['s1'] / 5) - ) + $this->stats['minAtack'] + $this->stats['yron_min']; - $y[1] = ceil($y[0] + 3) + $this->stats['maxAtack'] + $this->stats['yron_max']; - if ($y[0] < 1) { - $y[0] = 1; - } - if ($y[1] < 1) { - $y[1] = 1; - } - $r .= $y[0] . '-' . $y[1]; - } - /* второе оружие */ - if (isset($w2['id'])) { - $tp = 0; - $t = 0; - $i = 1; - $d = ConversionHelper::dataStringToArray($w2['data']); - while ($i <= 4) { - if ($t < $d['tya' . $i]) { - $t = $d['tya' . $i]; - $tp = $i; - } - $i++; - } - $y = $this->weaponAtc($w2, $this->stats, $tp); - if ($v == 'yrontest-krit') { - $y[0] = $y[2]; - $y[1] = $y[3]; - } - if ($y[0] < 1) { - $y[0] = 1; - } - if ($y[1] < 1) { - $y[1] = 1; - } - $r .= ' / ' . $y[0] . '-' . $y[1] . ''; - } - /* --- */ - } elseif ($v == 'yron') { - /* первое оружие или кулак */ - while ($i < count($this->stats['items'])) { - if ($this->stats['items'][$i]['inOdet'] == 3 && $w1 == 0 && $this->stats['items'][$i]['type'] >= 18 && $this->stats['items'][$i]['type'] <= 28) { - $w1 = $this->stats['items'][$i]; - } elseif ($this->stats['items'][$i]['inOdet'] == 14 && $w2 == 0 && $this->stats['items'][$i]['type'] >= 18 && $this->stats['items'][$i]['type'] <= 28) { - $w2 = $this->stats['items'][$i]; - } - $i++; - } - if (isset($w1['id']) && $w1['inOdet'] != 14) { - $tp = 0; - $t = 0; - $i = 1; - $d = ConversionHelper::dataStringToArray($w1['data']); - while ($i <= 4) { - if (isset($d['tya' . $i]) && $t < $d['tya' . $i]) { - $t = $d['tya' . $i]; - $tp = $i; - } - $i++; - } - $y = $this->weaponAtc($w1, $this->stats, $tp); - if ($y[0] < 1) { - $y[0] = 1; - } - if ($y[1] < 1) { - $y[1] = 1; - } - $r .= '' . $y[0] . '-' . $y[1] . ''; - } else { - //урон кулаком - $y[0] = ceil($this->stats['s1'] * 1.4) + $this->stats['minAtack'] + $this->stats['yron_min']; - $y[1] = ceil(0.4 + $y[0] / 0.9) + $this->stats['maxAtack'] + $this->stats['yron_max']; - if ($y[0] < 1) { - $y[0] = 1; - } - if ($y[1] < 1) { - $y[1] = 1; - } - $r .= $y[0] . '-' . $y[1]; - } - /* второе оружие */ - if (isset($w2['id'])) { - $tp = 0; - $t = 0; - $i = 1; - $d = ConversionHelper::dataStringToArray($w2['data']); - while ($i <= 4) { - if ($t < $d['tya' . $i]) { - $t = $d['tya' . $i]; - $tp = $i; - } - $i++; - } - $y = $this->weaponAtc($w2, $this->stats, $tp); - if ($y[0] < 1) { - $y[0] = 1; - } - if ($y[1] < 1) { - $y[1] = 1; - } - $r .= ' / ' . $y[0] . '-' . $y[1] . ''; - } - } else { - //модификаторы - /* первое оружие или кулак */ - $ry = 0; - while ($i < count($this->stats['items'])) { - if ($this->stats['items'][$i]['inOdet'] == 3 && $w1 == 0 && $this->stats['items'][$i]['type'] >= 18 && $this->stats['items'][$i]['type'] <= 28) { - $w1 = $this->stats['items'][$i]; - } elseif ($this->stats['items'][$i]['inOdet'] == 14 && $w2 == 0 && $this->stats['items'][$i]['type'] >= 18 && $this->stats['items'][$i]['type'] <= 28) { - $w2 = $this->stats['items'][$i]; - } - $i++; - } - if (isset($w1['id']) && $w1['inOdet'] != 14) { - $tp = 0; - $t = 0; - $i = 1; - $d = ConversionHelper::dataStringToArray($w1['data']); - $y = 0; - if (isset($d['sv_' . $v])) { - $y += $d['sv_' . $v]; - } - if (isset($this->stats[$v])) { - $y += $this->stats[$v]; - } - $ry = $y; - $r .= '' . $y . ''; - } else { - //кулаком - $r .= $this->stats[$v]; - $ry = $this->stats[$v]; - } - /* второе оружие */ - if (isset($w2['id'])) { - $tp = 0; - $t = 0; - $i = 1; - $d = ConversionHelper::dataStringToArray($w2['data']); - $y = @$this->stats[$v] + @$d['sv_' . $v]; - if ($y != $ry) { - $r .= ' / ' . $y . ''; - } else { - $r = str_replace('title="' . $w1['name'] . '"', '', $r); - } - } - //модификаторы - } - return $r; - } - - public function rep_zv(int $id, int $e): string - { - $r = '0 / 0'; - if ($id == 1) { - //Храм знаний - if ($e > 9999) { - $r = 'Посвященный третьего круга, ' . $e . ' / ??'; - } elseif ($e > 999) { - $r = 'Посвященный второго круга, ' . $e . ' / 9999'; - } elseif ($e > 99) { - $r = 'Посвященный первого круга, ' . $e . ' / 999'; - } else { - $r = $e . ' / 99'; - } - } elseif ($id == 2 || $id == 3 || $id == 4 || $id == 6 || $id == 7 || $id == 8) { - //Capital city - if ($e > 24999) { - $r = 'Рыцарь второго круга, ' . $e . ' / ??'; - } elseif ($e > 9999) { - $r = 'Рыцарь первого круга, ' . $e . ' / 24999'; - } else { - $r = $e . ' / 10000'; - } - } elseif ($id == 9) { - //Dreams city - if ($e > 9999) { - $r = 'Посвященный третьего круга, [' . $e . ']'; - } elseif ($e > 4999) { - $r = 'Посвященный второго круга,' . $e . ' / 9999'; - } elseif ($e > 999) { - $r = 'Посвященный первого круга, ' . $e . ' / 4999'; - } else { - $r = $e . ' / 999'; - } - } elseif ($id == 10) { - //Гора легиона - if ($e > 9999) { - $r = 'Посвященный второго круга,[' . $e . ']'; - } elseif ($e > 999) { - $r = 'Посвященный первого круга, ' . $e . ' / 4999'; - } else { - $r = $e . ' / 999'; - } - } elseif ($id == 11) { - //Излом Хаоса - if ($e > 9999) { - $r = 'Легенда Излома Хаоса, [' . $e . ']'; - } elseif ($e > 4999) { - $r = 'Чемпион Излома Хаоса,' . $e . ' / 9999'; - } elseif ($e > 999) { - $r = 'Знаток Излома Хаоса, ' . $e . ' / 4999'; - } else { - $r = $e . ' / 999'; - } - } - - return $r; - } - - public function getNum($v) - { - $plid = $v; - $pi = iconv_strlen($plid); - if ($pi < 5) { - $i = 0; - while ($i <= 5 - $pi) { - $plid = '0' . $plid; - $i++; - } - } - return $plid; - } public function addNewbot($id, $botDate, $clon, $logins_bot = null, $luser = null, $round = null) { @@ -4631,22 +3894,6 @@ class User } } - /** Для совместимости. Поиск по файлам $this->additem выдаёт сотни отсылок с видимо подключаемымим файлами - * в которых невозможно отследить зависимость и сделать полноценную замену. - * @param $id - * @param $uid - * @param $md - * @param $dn - * @param $mxiznos - * @param $nosudba - * @param $plavka - * @return int|mixed|string - */ - public function addItem($id, $uid, $md = null, $dn = null, $mxiznos = null, $nosudba = null, $plavka = null) - { - return ItemsModel::addItem($id, $uid, $md, $dn, $mxiznos, $nosudba, $plavka); - } - /** Для совместимости. Поиск по файлам $this->additem выдаёт сотни отсылок с видимо подключаемымим файлами * в которых невозможно отследить зависимость и сделать полноценную замену. * @param $id @@ -7429,39 +6676,15 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.` return floor($zahl * pow(10, $decimals)) / pow(10, $decimals); } + /** + * @param $v + * @param $t + * @return string + * @deprecated + */ public function zuby($v, $t = 0): string { - $r = ''; - if ($v < 0) { - $v = 0; - } - if ($t == 0) { - $names[] = ' '; - $names[] = ' '; - $names[] = ' '; - $names[] = ' '; - } else { - $names[] = ' '; - $names[] = ' '; - $names[] = ' '; - $names[] = ' '; - } - $int = $v; - do { - $mod = $int % 10; - $int = floor($int / 10);//или быстрее $int = ($int-$mod)/10; - $r = array_shift($names) . "" . $mod . $r; - } while ($int); - - $ost = explode('.', $v); - $ost = $ost[1]; - if (empty($ost)) { - $ost = '00'; - } - - $r .= '.' . $ost; - - return $r; + return ''; } private function shopSaleM($val, $itm): float @@ -7509,50 +6732,6 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.` return round(($val / 100 * (100 - $proc)), 2); } - public function shopSaleM($val, $itm): float - { - $procs = [ - 0, //0 - 0, //1 - 0, //2 - 0, //3 - 0, //4 - 0, //5 - 0, //6 - 0, //7 - 5, - 30, - 30, - 30, - 30, - 30, - 30, - 30, - 30, - 30, - 30, - 30, - 30, - 30, - ]; - $po = ConversionHelper::dataStringToArray($itm['data']); - $proc = $procs[$po['tr_lvl']]; - // - if ($itm['type'] >= 28) { - $proc = 50; - } - if ($itm['type'] == 46) { - $proc = 0; - } - if (Config::get('shop_all') > 0) { - $proc = 100 - Config::get('shop_all'); - } elseif (Config::get('shop_all_type1') > 0 && !isset($this->info['inBerezka'])) { - $proc = 100 - Config::get('shop_all_type1'); - } elseif (Config::get('shop_all_type2') > 0 && isset($this->info['inBerezka'])) { - $proc = 100 - Config::get('shop_all_type2'); - } - return round(($val / 100 * (100 - $proc)), 2); - } public function round2($v) { @@ -7588,49 +6767,6 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.` return $r; } - public function testVipItems($slot_new): bool - { - $sp = mysql_query( - 'SELECT `i`.`id`,`m`.`type`,`i`.`2price`,`m`.`price2` FROM `items_users` AS `i` LEFT JOIN `items_main` AS `m` ON `m`.`id` = `i`.`item_id` WHERE `i`.`uid` = "' . $this->info['id'] . '" AND `i`.`delete` = "0" AND `i`.`data` LIKE "%vip_sale%" LIMIT 20' - ); - $itm = []; - $slot = []; - $j = 0; - if ($slot_new > 0) { - $itm[$j] = ['new']; - $slot[$slot_new][] = $j; - $j++; - } - $r = true; - while ($pl = mysql_fetch_array($sp)) { - $itm[$j] = $pl; - $slot[$pl['type']][] = $j; - $j++; - } - $l = count($slot[18]) + count($slot[19]) + count($slot[20]) + count($slot[21]) + count($slot[22]) + count( - $slot[23] - ) + count($slot[24]) + count($slot[25]) + count($slot[26]) + count($slot[27]) + count($slot[28]); - $v = count($slot[9]) + count($slot[10]) + count($slot[11]); - $a = count($itm) - $l - $v; - if ($this->stats['silver'] == 2) { - // 3 Артефакта (1оружие и все кроме ювелирки) - if ($j > 3 || $l > 1 || $v > 0) { - $r = false; - } - } elseif ($this->stats['silver'] == 3) { - // 6 Артефактов (1 оружие, 1 ювелирка и 4 вещи на выбор) - if ($j > 6 || $l > 1 || $v > 1) { - $r = false; - } - } elseif ($this->stats['silver'] == 4) { - // 9 Артефактов (2 оружия, 2 ювелирки и 5 вещей на выбор) - if ($j > 9 || $l > 2 || $v > 2) { - $r = false; - } - } - return $r; - } - public function stack($id) { global $c, $code; @@ -8954,31 +8090,6 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.` return '
' . $r . '
'; } - public function info_remont(): string - { - $r = ''; - $sp = mysql_query( - 'SELECT `im`.`name`,`iu`.`iznosNOW`,`iu`.`iznosMAX` - FROM `items_users` AS `iu` - LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.`item_id`) - WHERE - `iu`.`uid` = ' . ($this->info['id']) . ' AND - `iu`.`delete` = 0 AND - `iu`.`inShop` = 0 AND - `iu`.`inOdet` > 0 AND - `iu`.`inOdet` < 18 - LIMIT 18' - ); - while ($pl = mysql_fetch_array($sp)) { - if ($pl['iznosNOW'] <= ceil($pl['iznosMAX'] * 0.80)) { - continue; - } - $r .= '' . $pl['name'] . ' [' . floor($pl['iznosNOW']) . '/' . - ceil($pl['iznosMAX']) . '] требуется ремонт
'; - } - return '
' . $r . '
'; - } - public function snatItemAll(int $uid): int { $upd = mysql_query( @@ -9036,10 +8147,8 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.` $notr++; } } - if (isset($tr['vip_sale'])) { - if ($this->stats['silver'] < 2) { - $notr++; - } + if (isset($tr['vip_sale']) && $this->stats['silver'] < 2) { + $notr++; } if (isset($tr['sudba'])) { if ($tr['sudba'] != '0' && $tr['sudba'] != $this->info['login']) { @@ -9930,11 +9039,6 @@ LIMIT 1' //получаем уровень - public function addEkr($amount) - { - Db::sql('update users set money2 = money2 + ? where id = ?', [$amount, $this->info['id']]); - } - public function addEkr($amount, $uid = 0) { if ($uid === 0) {