diff --git a/_incl_data/class/User.php b/_incl_data/class/User.php index 97f86257..004fd18c 100644 --- a/_incl_data/class/User.php +++ b/_incl_data/class/User.php @@ -66,7 +66,7 @@ class User 'emeraldscity' => 6, 'suncity' => 7, 'dreamscity' => 8, - 'devilscity' => 10 + 'devilscity' => 10, ]; public array $city_name = [ 'emeraldscity' => 'Emeralds city', @@ -9092,40 +9092,23 @@ LIMIT 1' } } - public function snatItem(int $id, int $uid): int + public function snatItem(int $id, int $uid = 0): int { - if ($uid != 0) { - $au = 'AND `iu`.`uid`="' . $uid . '"'; - } else { - $au = ''; - } - $itm = mysql_fetch_array( - $cl = mysql_query( - 'SELECT - `im`.`id`,`im`.`name`,`im`.`img`,`im`.`type`,`im`.`inslot`,`im`.`2h`,`im`.`2too`,`im`.`iznosMAXi`,`im`.`inRazdel`,`im`.`price1`,`im`.`price2`,`im`.`pricerep`,`im`.`magic_chance`,`im`.`info`,`im`.`massa`,`im`.`level`,`im`.`magic_inci`,`im`.`overTypei`,`im`.`group`,`im`.`group_max`,`im`.`geni`,`im`.`ts`,`im`.`srok`,`im`.`class`,`im`.`class_point`,`im`.`anti_class`,`im`.`anti_class_point`,`im`.`max_text`,`im`.`useInBattle`,`im`.`lbtl`,`im`.`lvl_itm`,`im`.`lvl_exp`,`im`.`lvl_aexp`, - `iu`.`id`,`iu`.`item_id`,`iu`.`1price`,`iu`.`2price`,`iu`.`uid`,`iu`.`use_text`,`iu`.`data`,`iu`.`inOdet`,`iu`.`inShop`,`iu`.`delete`,`iu`.`iznosNOW`,`iu`.`iznosMAX`,`iu`.`gift`,`iu`.`gtxt1`,`iu`.`gtxt2`,`iu`.`kolvo`,`iu`.`geniration`,`iu`.`magic_inc`,`iu`.`maidin`,`iu`.`lastUPD`,`iu`.`timeOver`,`iu`.`overType`,`iu`.`secret_id`,`iu`.`time_create`,`iu`.`time_sleep`,`iu`.`inGroup`,`iu`.`dn_delete`,`iu`.`inTransfer`,`iu`.`post_delivery`,`iu`.`lbtl_`,`iu`.`bexp`,`iu`.`so`,`iu`.`blvl` - FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.`item_id`) WHERE `iu`.`id`="' . $id . '" AND `iu`.`inOdet`!="0" ' . $au . ' AND `iu`.`delete`="0" LIMIT 1 FOR UPDATE' - ) - ); - if (isset($itm['id'])) { - $upd = mysql_query( - 'UPDATE `items_users` SET `lastUPD`="' . time( - ) . '",`inOdet`="0" WHERE `id`="' . $itm['id'] . '" LIMIT 1' - ); - if ($upd) { - if (isset($_GET['remitem']) || isset($_GET['sid'])) { - $this->info['autospell'] = 1; - mysql_query( - 'UPDATE `users` SET `autospell` = "1" WHERE `id` = "' . $this->info['id'] . '" LIMIT 1' - ); - } - return 1; - } else { - return 0; - } - } else { + if (empty($id)) { return 0; } + $au = "select count(*) from items_users where id = $id and inOdet != 0 and `delete` = 0"; + $au .= $uid > 0 ? " and uid = $uid" : ''; + $itm = Db::getValue($au); + if (empty($itm)) { + return 0; + } + Db::sql('update items_users set lastUPD = unix_timestamp(), inOdet = 0 where id = ?', [$id]); + if (isset($_GET['remitem']) || isset($_GET['sid'])) { + $this->info['autospell'] = 1; + Db::sql('update users set autospell = 1 where id = ?', [$this->info['id']]); + } + return 1; } public function snatItemAll(int $uid): int @@ -9479,6 +9462,7 @@ LIMIT 1' if ($inSlot == 3 || $inSlot == 14) { //Проверяем есть-ли двуручное оружие + //И естественно снимаем его, даже если руки пусты, отправляя туда NULL и ломая игру. Сука! if ($this->stats['items'][$this->stats['wp3id']]['2h'] == 1 || $this->stats['items'][$this->stats['wp14id']]['2h'] == 1 || $itm['2h'] == 1) { $this->snatItem($this->stats['items'][$this->stats['wp3id']]['id'], $uid); $this->snatItem($this->stats['items'][$this->stats['wp14id']]['id'], $uid); diff --git a/main.php b/main.php index 538b1247..72808666 100644 --- a/main.php +++ b/main.php @@ -463,7 +463,9 @@ if (isset($_GET['security']) && !isset($u->tfer['id']) && $trololo == 1) { require_once('modules_data/_obraz.php'); } elseif (isset($_GET['skills']) && !isset($u->tfer['id']) && $trololo == 1) { require_once('modules_data/_umenie.php'); - } elseif ((isset($_GET['transfer']) || isset($u->tfer['id'])) && $u->info['level'] >= Config::get('level_ransfer') && $trololo == 1 && $u->info['inTurnir'] == 0 && $u->info['inTurnirnew'] == 0) { + } elseif ((isset($_GET['transfer']) || isset($u->tfer['id'])) && $u->info['level'] >= Config::get( + 'level_ransfer' + ) && $trololo == 1 && $u->info['inTurnir'] == 0 && $u->info['inTurnirnew'] == 0) { if ($u->info['allLock'] > time()) { require_once('modules_data/_locations.php'); echo '