Замена mysql_query

This commit is contained in:
Ivor Barhansky 2024-02-09 20:21:10 +02:00
parent 2b2767044c
commit e3f362cf23

View File

@ -4527,42 +4527,76 @@ JS;
return '{' . $a . 'x' . $id . 'x' . $rnd . '}';
}
//Действия бота (атака)
public function spaCheck($u1): void
/**
* Свиток спасения.
*
* Воскрешение мёртвого игрока (hpnow = 0) чтобы он мог продолжать бой.
* @param int $u1 id игрока
* @return void
*/
public function spaCheck(int $u1): void
{
global $u;
if ($this->stats[$this->uids[$u1]]['hpNow'] >= 1) {
return;
}
mysql_query('DELETE FROM `battle_act` WHERE `uid1` = "' . $u1 . '" OR `uid2` = "' . $u1 . '"');
Db::sql('delete from battle_act where uid1 = ? or uid2 = ?', [$u1, $u1]);
if ($this->stats[$this->uids[$u1]]['spasenie'] > 0 && $this->users[$this->uids[$u1]]['tactic7'] >= 25) {
//Свиток спасения
if ($this->stats[$this->uids[$u1]]['s7'] > 49 && $this->stats[$this->uids[$u1]]['s7'] < 75) {
//Даем призрачку
mysql_query(
"INSERT INTO `eff_users`
(`id_eff`, `uid`, `name`, `data`, `overType`, `timeUse`, `timeAce`, `user_use`, `delete`, `v1`, `v2`, `img2`, `x`, `hod`, `bj`, `sleeptime`, `no_Ace`, `file_finish`, `tr_life_user`, `deactiveTime`, `deactiveLast`, `mark`, `bs`) VALUES
(22, '" . $u1 . "', 'Призрачная защита', 'add_zmproc=75|add_zaproc=75', 0, 77, 0, '" . $u1 . "', 0, 'priem', 141, 'spirit_block25.gif', 1, 1, '0', 0, 0, '', 0, 0, 0, 0, 0);"
Effects::addCustom(
[
'id_eff' => 22,
'uid' => $u1,
'name' => 'Призрачная защита',
'data' => 'add_zmproc=75|add_zaproc=75',
'timeUse' => 77,
'user_use' => $u1,
'v1' => 'priem',
'v2' => 141,
'img2' => 'spirit_block25.gif',
'hod' => 1,
]
);
$this->stats[$this->uids[$u1]]['hpNow'] = floor($this->stats[$this->uids[$u1]]['hpAll'] * 0.5);
$this->stats[$this->uids[$u1]]['mpNow'] = floor($this->stats[$this->uids[$u1]]['mpAll'] * 0.5);
} elseif ($this->stats[$this->uids[$u1]]['s7'] > 74 && $this->stats[$this->uids[$u1]]['s7'] < 100) {
//Абсолютная защита
mysql_query(
"INSERT INTO `eff_users`
(`id_eff`, `uid`, `name`, `data`, `overType`, `timeUse`, `timeAce`, `user_use`, `delete`, `v1`, `v2`, `img2`, `x`, `hod`, `bj`, `sleeptime`, `no_Ace`, `file_finish`, `tr_life_user`, `deactiveTime`, `deactiveLast`, `mark`, `bs`) VALUES
(22, '" . $u1 . "', 'Абсолютная защита', 'add_zmproc=100|add_zaproc=100', 0, 77, 0, '" . $u1 . "', 0, 'priem', 358, 'block_absolute.gif', 1, 1, '0', 0, 0, '', 0, 0, 0, 0, 0);"
Effects::addCustom(
[
'id_eff' => 22,
'uid' => $u1,
'name' => 'Абсолютная защита',
'data' => 'add_zmproc=100|add_zaproc=100',
'timeUse' => 77,
'user_use' => $u1,
'v1' => 'priem',
'v2' => 358,
'img2' => 'block_absolute.gif',
'hod' => 1,
]
);
$this->stats[$this->uids[$u1]]['hpNow'] = floor($this->stats[$this->uids[$u1]]['hpAll'] * 0.75);
$this->stats[$this->uids[$u1]]['mpNow'] = floor($this->stats[$this->uids[$u1]]['mpAll'] * 0.75);
} elseif ($this->stats[$this->uids[$u1]]['s7'] > 99) {
//Абсолютная защита x2
mysql_query(
"INSERT INTO `eff_users`
(`id_eff`, `uid`, `name`, `data`, `overType`, `timeUse`, `timeAce`, `user_use`, `delete`, `v1`, `v2`, `img2`, `x`, `hod`, `bj`, `sleeptime`, `no_Ace`, `file_finish`, `tr_life_user`, `deactiveTime`, `deactiveLast`, `mark`, `bs`) VALUES
(22, '" . $u1 . "', 'Защита Мироздателя', 'add_zmproc=100|add_zaproc=100', 0, 77, 0, '" . $u1 . "', 0, 'priem', 358, 'wis_white_shield.gif', 1, 2, '0', 0, 0, '', 0, 0, 0, 0, 0);"
Effects::addCustom(
[
'id_eff' => 22,
'uid' => $u1,
'name' => 'Божественная защита',
'data' => 'add_zmproc=100|add_zaproc=100',
'timeUse' => 77,
'user_use' => $u1,
'v1' => 'priem',
'v2' => 358,
'img2' => 'wis_white_shield.gif',
'hod' => 2,
]
);
$this->stats[$this->uids[$u1]]['hpNow'] = floor($this->stats[$this->uids[$u1]]['hpAll']);
$this->stats[$this->uids[$u1]]['mpNow'] = floor($this->stats[$this->uids[$u1]]['mpAll']);
@ -4581,38 +4615,31 @@ JS;
$this->stats[$this->uids[$u1]]['mpNow'] = floor($this->stats[$this->uids[$u1]]['mpAll']);
}
mysql_query(
'DELETE FROM `eff_users` WHERE `uid` = "' . $u1 . '" AND `id_eff` = 22 AND `v1` = "priem" AND `v2` = 324'
);
mysql_query(
'UPDATE `stats` SET `hpNow` = "' . $this->stats[$this->uids[$u1]]['hpNow'] . '",`mpNow` = "' . $this->stats[$this->uids[$u1]]['mpNow'] . '", `tactic7` = `tactic7` - 25 WHERE `id` = "' . $u1 . '" LIMIT 1'
);
$mas['text'] = '{tm1} <strong>' . $this->stats[$this->uids[$u1]]['login'] . '</strong> убит...<strong>' . $this->stats[$this->uids[$u1]]['login'] . '</strong> был спасен. ';
Db::sql("delete from eff_users where uid = ? and id_eff = 22 and v1 = 'priem' and v2 = 324", [$u1]);
Db::sql('update stats set hpnow = ?, mpnow = ?, tactic7 = tactic7 - 25 where id = ?', [$this->stats[$this->uids[$u1]]['hpNow'], $this->stats[$this->uids[$u1]]['mpNow'], $u1]);
$this->priemAddLog(
$id, 1, 2, $u->info['id'], $u1,
22, 1, 2, $u->info['id'], $u1,
' ',
$mas['text'],
'{tm1} <strong>' . $this->stats[$this->uids[$u1]]['login'] . '</strong> убит...<strong>' . $this->stats[$this->uids[$u1]]['login'] . '</strong> был спасен. ',
$this->hodID
);
} elseif (isset($this->stats[$this->uids[$u1]]['login'])) {
mysql_query('UPDATE `stats` SET `hpNow` = "0",`mpNow` = "0" WHERE `id` = "' . $u1 . '" LIMIT 1');
Db::sql('update stats set hpnow = 0, mpnow = 0 where id = ?', [$u1]);
$this->stats[$this->uids[$u1]]['hpNow'] = 0;
$this->users[$this->uids[$u1]]['hpNow'] = 0;
$mas['text'] = '{tm1} <strong>' . $this->stats[$this->uids[$u1]]['login'] . '</strong> погиб.';
$this->priemAddLog(
$id, 1, 2, $u->info['id'], $u1,
22, 1, 2, $u->info['id'], $u1,
' ',
$mas['text'],
($this->hodID + 1)
//Удаляем размен из базы //ТУТ возможен лаг удаления
'{tm1} <strong>' . $this->stats[$this->uids[$u1]]['login'] . '</strong> погиб.',
$this->hodID + 1
);
mysql_query(
'DELETE FROM `battle_act` WHERE `uid1` = "' . $this->stats[$this->uids[$u1]]['id'] . '" OR `uid2` = "' . $this->stats[$this->uids[$u1]]['id'] . '" OR `uid2` = "-' . $this->stats[$this->uids[$u1]]['id'] . '"'
);
mysql_query(
'DELETE FROM `eff_users` WHERE `uid` = "' . $this->stats[$this->uids[$u1]]['id'] . '" AND `v1` = "priem" AND `delete` =0'
Db::sql(
'delete from battle_act where uid1 = ? or uid2 = ? or uid2 = ?',
[$this->stats[$this->uids[$u1]]['id'], $this->stats[$this->uids[$u1]]['id'], -$this->stats[$this->uids[$u1]]['id']]
);
Effects::removePriems($this->stats[$this->uids[$u1]]['id']);
}
}