Запросы в несуществующий базы, снятие вещей из пустых слотов..
This commit is contained in:
parent
f1d838fcc4
commit
a1aca77a35
@ -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 = '';
|
||||
if (empty($id)) {
|
||||
return 0;
|
||||
}
|
||||
$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) {
|
||||
$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;
|
||||
mysql_query(
|
||||
'UPDATE `users` SET `autospell` = "1" WHERE `id` = "' . $this->info['id'] . '" LIMIT 1'
|
||||
);
|
||||
Db::sql('update users set autospell = 1 where id = ?', [$this->info['id']]);
|
||||
}
|
||||
return 1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
|
9
main.php
9
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 '<script>setTimeout(function(){alert("Вам запрещены передачи до ' . date(
|
||||
@ -495,7 +497,10 @@ if (in_array(
|
||||
|
||||
$iloc = '';
|
||||
$iloce = '';
|
||||
$sp = Db::getRows('select * from items_local where (room = ? or room = -1) and `delete` = 0 and user_take = 0 and tr_login = ?', [$u->info['room'], $u->info['login']]);
|
||||
$sp = Db::getRows(
|
||||
'select * from items_local where (room = ? or room = -1) and `delete` = 0 and user_take = 0 and tr_login = ?',
|
||||
[$u->info['room'], $u->info['login']]
|
||||
);
|
||||
foreach ($sp as $pl) {
|
||||
$itmo = mysql_fetch_array(mysql_query('SELECT * FROM `items_main` WHERE `id` = ' . $pl['item_id']));
|
||||
if (isset($itmo['id'])) {
|
||||
|
42
online.php
42
online.php
@ -1,11 +1,17 @@
|
||||
<?php
|
||||
|
||||
if (!defined('GAME_VERSION')) {
|
||||
require_once '_incl_data/autoload.php';
|
||||
}
|
||||
|
||||
use Core\Config;
|
||||
use Core\Database;
|
||||
use Core\Db;
|
||||
|
||||
//
|
||||
const GAME = true;
|
||||
require_once '_incl_data/__config.php';
|
||||
require_once '_incl_data/class/__db_connect.php';
|
||||
|
||||
Config::init();
|
||||
Database::init();
|
||||
|
||||
$u = User::start();
|
||||
$filter = new Filter();
|
||||
$chat = new Chat();
|
||||
@ -25,11 +31,11 @@ if ($u->info['bithday'] == '01.01.1800') {
|
||||
}
|
||||
|
||||
if ($u->info['online'] < time() - 60) {
|
||||
mysql_query('UPDATE users SET online = unix_timestamp() WHERE id = ' . $u->info['id']);
|
||||
Db::sql('update users set online = unix_timestamp() where id = ?', [$u->info['id']]);
|
||||
$filter->setOnline($u->info['online'], $u->info['id']);
|
||||
}
|
||||
|
||||
function isModerOrAdmin($uinfo)
|
||||
function isModerOrAdmin($uinfo): bool
|
||||
{
|
||||
return $uinfo['admin'] > 0 ||
|
||||
(
|
||||
@ -42,19 +48,13 @@ function isModerOrAdmin($uinfo)
|
||||
}
|
||||
|
||||
if (isset($_POST['delMsg']) && isModerOrAdmin($u->info)) {
|
||||
if (((int)$_POST['delMsg']) > 0) {
|
||||
mysql_query(
|
||||
'UPDATE `chat` SET `delete` = "' . $u->info['id'] . '" WHERE `id` = "' . mysql_real_escape_string(
|
||||
((int)$_POST['delMsg'])
|
||||
) . '" LIMIT 1'
|
||||
);
|
||||
$delmsgid = (int)$_POST['delMsg'];
|
||||
if ($delmsgid > 0) {
|
||||
Db::sql('update chat set `delete` = ? where id = ?', [$u->info['id'], $delmsgid]);
|
||||
} else {
|
||||
mysql_query(
|
||||
'UPDATE `users` SET `molch3` = "' . (time() + 3600 * 3) . '" WHERE `id` = "' . mysql_real_escape_string(
|
||||
-((int)$_POST['delMsg'])
|
||||
) . '" LIMIT 1'
|
||||
);
|
||||
Db::sql('update users set molch3 = unix_timestamp() + 3600 * 3 where id = ?', [-$delmsgid]);
|
||||
}
|
||||
unset($delmsgid);
|
||||
}
|
||||
|
||||
$r = [
|
||||
@ -81,7 +81,7 @@ if (isset($_POST['msg']) && str_replace(' ', '', $_POST['msg']) != '') {
|
||||
$_POST['msg'] = str_replace('\x3C', '<', $_POST['msg']);
|
||||
$_POST['msg'] = str_replace('\x3', '>', $_POST['msg']);
|
||||
|
||||
function tolink($buf)
|
||||
function tolink($buf): string
|
||||
{
|
||||
$x = explode(" ", $buf);
|
||||
$newbuf = '';
|
||||
@ -192,10 +192,10 @@ if (isset($_POST['msg']) && str_replace(' ', '', $_POST['msg']) != '') {
|
||||
}
|
||||
}
|
||||
//
|
||||
$newbuf .= preg_match
|
||||
(
|
||||
$newbuf .= preg_match(
|
||||
"/(https:\\/\\/)?(new-combats+\\.com(([ \"'>\r\n\t])|(\\/([^ \"'>\r\n\t]*)?)))/",
|
||||
$x[$j], $ok
|
||||
$x[$j],
|
||||
$ok
|
||||
) ? str_replace(
|
||||
$ok[2], "<small><a href=https://$ok[2] target=_blank ><i>" . $uname . "</i></a></small>",
|
||||
str_replace("https://", "", $x[$j])
|
||||
|
Loading…
Reference in New Issue
Block a user