Замена mysql_query

This commit is contained in:
Ivor Barhansky 2024-02-09 19:49:51 +02:00
parent 664c24ff1e
commit c18241bda3

View File

@ -1,6 +1,5 @@
<?php <?php
use Battle\Fighter;
use Battle\Finish; use Battle\Finish;
use Battle\Helper; use Battle\Helper;
use Battle\Info; use Battle\Info;
@ -1038,7 +1037,8 @@ JS;
} else { } else {
$this->i->setIzlomround($iz['round']); $this->i->setIzlomround($iz['round']);
mysql_query( mysql_query(
'UPDATE `battle` SET `izlomObrNow` = ' . $obr . ',`izlomObr` = `izlomObr` + ' . $obr . ',`timeout` = (`timeout`+5),`izlomRound` = "' . ($this->i->getIzlomround() + 1) . '",`izlomRoundSee` = `izlomRoundSee`+1 WHERE `id` = "' . $this->i->id . '" LIMIT 1' 'UPDATE `battle` SET `izlomObrNow` = ' . $obr . ',`izlomObr` = `izlomObr` + ' . $obr . ',`timeout` = (`timeout`+5),`izlomRound` = "' . ($this->i->getIzlomround(
) + 1) . '",`izlomRoundSee` = `izlomRoundSee`+1 WHERE `id` = "' . $this->i->id . '" LIMIT 1'
); );
$this->stats[$this->uids[$u->info['id']]]['hpNow'] += $this->stats[$this->uids[$u->info['id']]]['hpAll'] * 0.25; $this->stats[$this->uids[$u->info['id']]]['hpNow'] += $this->stats[$this->uids[$u->info['id']]]['hpAll'] * 0.25;
$this->stats[$this->uids[$u->info['id']]]['mpNow'] += $this->stats[$this->uids[$u->info['id']]]['mpAll'] * 0.25; $this->stats[$this->uids[$u->info['id']]]['mpNow'] += $this->stats[$this->uids[$u->info['id']]]['mpAll'] * 0.25;
@ -4111,10 +4111,14 @@ JS;
$this->ucleari[] = $uid; $this->ucleari[] = $uid;
} }
/**
* Отправка в лог боя результата размена.
* @param $id
* @param $at
* @return void
*/
private function addlogRazmen($id, $at): void private function addlogRazmen($id, $at): void
{ {
$dies = [ $dies = [
1 => 0, 1 => 0,
2 => 0, 2 => 0,
@ -4217,23 +4221,13 @@ JS;
if ($this->atacks[$id]['tpo' . $a] == 2) { if ($this->atacks[$id]['tpo' . $a] == 2) {
$mas['text'] .= '{u1} потратил свой ход на магию.'; $mas['text'] .= '{u1} потратил свой ход на магию.';
} else { } else {
if ($this->i->razdel == 0 && $this->i->dnId == 0 && $this->i->izlom == 0) { if ($this->i->razdel == 0 && $this->i->dnId == 0 && $this->i->izlom == 0) {
mysql_query( Db::sql('insert into battle_out (time, battle, uid1, uid2, `out`) values (unix_timestamp(),?,?,?,1)', [$this->i->id, $u1, $u2]);
'INSERT INTO `battle_out` (`battle`,`uid1`,`uid2`,`time`,`out`) VALUES (
"' . $this->i->id . '","' . $u1 . '","' . $u2 . '","' . time() . '","1"
)'
);
} }
if (isset($u1)) {
$mas['text'] .= '{u1} пропустил свой ход.'; $mas['text'] .= '{u1} пропустил свой ход.';
//Проверка сброс туманок //Cброс туманок
mysql_query( Db::sql("delete from eff_users where uid = ? and v1 = 'priem' and v2 in (273,286,287,288) limit 1", [$u1]);
'UPDATE `eff_users` SET `delete` = "' . time(
) . '" WHERE `uid` = "' . $u1 . '" AND `delete` = 0 AND `v1` = "priem" AND (`v2`=288 OR `v2`=287 OR `v2`=286 OR `v2`=273) LIMIT 1'
);
}
} }
$mas['text'] = '{tm1} ' . $mas['text']; $mas['text'] = '{tm1} ' . $mas['text'];
Log::add($mas); Log::add($mas);
@ -4241,9 +4235,7 @@ JS;
$j = 0; $j = 0;
while ($j < count($at[$a]['atack']) && $j < 8) { while ($j < count($at[$a]['atack']) && $j < 8) {
$mas['text'] = ''; $mas['text'] = '';
$wt = [ $wt = [
21 => 4, 21 => 4,
22 => 5, 22 => 5,
@ -4254,7 +4246,6 @@ JS;
26 => 22, 26 => 22,
]; ];
[$attackItem, $attackZone] = Log::getAttackTurnText($at[$a]['atack'][$j][0], $wt[$at[$a]['atack'][$j]['wt']]); [$attackItem, $attackZone] = Log::getAttackTurnText($at[$a]['atack'][$j][0], $wt[$at[$a]['atack'][$j]['wt']]);
$zone = "{zn2_{$at[$a]['atack'][$j][0]}}"; $zone = "{zn2_{$at[$a]['atack'][$j][0]}}";
@ -4302,22 +4293,17 @@ JS;
if ((!isset($this->stats[$this->uids[$u2]]['notravma']) || $this->stats[$this->uids[$u2]]['notravma'] == 0) && isset($at[$a]['atack'][$j]['yron']['travma']) && $at[$a]['atack'][$j]['yron']['travma'][0] > 0 && floor( if ((!isset($this->stats[$this->uids[$u2]]['notravma']) || $this->stats[$this->uids[$u2]]['notravma'] == 0) && isset($at[$a]['atack'][$j]['yron']['travma']) && $at[$a]['atack'][$j]['yron']['travma'][0] > 0 && floor(
$at[$a]['atack'][$j]['yron']['hp'] $at[$a]['atack'][$j]['yron']['hp']
) <= 0) { ) <= 0) {
$tr_pl = mysql_fetch_array( $tr_pl = Db::getRow('select id, v1 from eff_users where id_eff = 4 and uid = ? order by v1 desc limit 1', [$u2]);
mysql_query(
'SELECT `id`,`v1` FROM `eff_users` WHERE `id_eff` = 4 AND `uid` = "' . $u2 . '" AND `delete` = "0" ORDER BY `v1` DESC LIMIT 1' if (!isset($tr_pl['id']) || (int)$tr_pl['v1'] < 3) {
)
);
if (!isset($tr_pl['id']) || $tr_pl['v1'] < 3) {
//263 //263
if (isset($tr_pl['id'])) { if (isset($tr_pl['id'])) {
$at[$a]['atack'][$j]['yron']['travma'][0] = rand(($tr_pl['v1'] + 1), 3); $at[$a]['atack'][$j]['yron']['travma'][0] = rand(((int)$tr_pl['v1'] + 1), 3);
} }
$tr_pl2 = mysql_fetch_array(
mysql_query( $hasInjuryImmunity = Db::getValue("select count(id) from eff_users where uid = ? and name like '%Защита от травм%'") > 0;
'SELECT `id` FROM `eff_users` WHERE `uid` = "' . $u2 . '" AND `delete` = "0" AND `name` LIKE "%Защита от травм%" LIMIT 1'
) if (!$hasInjuryImmunity && $at[$a]['atack'][$j]['yron']['travma'][0] <= 3) {
);
if (!isset($tr_pl2['id']) && $at[$a]['atack'][$j]['yron']['travma'][0] <= 3) {
$mas['text'] = rtrim($mas['text'], '. '); $mas['text'] = rtrim($mas['text'], '. ');
$mas['text'] .= ', <span style="color: red;">нанеся противнику <strong>'; $mas['text'] .= ', <span style="color: red;">нанеся противнику <strong>';
if ($at[$a]['atack'][$j]['yron']['travma'][0] == 1) { if ($at[$a]['atack'][$j]['yron']['travma'][0] == 1) {
@ -4497,26 +4483,30 @@ JS;
//Персонаж 2 погиб от рук персонаж 1 //Персонаж 2 погиб от рук персонаж 1
$this->spaCheck($this->stats[$this->uids[$u2]]['id']); $this->spaCheck($this->stats[$this->uids[$u2]]['id']);
} }
//Записываем рейтинг //Записываем рейтинг
// if (
if ($this->i->type != 564 && $this->stats[$this->uids[$u1]]['inTurnir'] == 0 && $this->stats[$this->uids[$u2]]['inTurnir'] == 0 && $this->i->dnId == 0 && $this->i->izlom == 0) { $this->i->type != 564 &&
// $this->stats[$this->uids[$u1]]['inTurnir'] == 0 &&
$this->stats[$this->uids[$u2]]['inTurnir'] == 0 &&
$this->i->dnId == 0 &&
$this->i->izlom == 0
) {
if ($this->users[$this->uids[$u2]]['bot'] == 0) { if ($this->users[$this->uids[$u2]]['bot'] == 0) {
mysql_query( Db::sql(
'INSERT INTO `users_reting` (`uid`,`time`,`val`,`align`,`clan`) VALUES ( 'insert into users_reting (uid, time, val, align, clan) values (?,unix_timestamp(),?,?,?)',
"' . $u1 . '","' . time() . '","' . $rtng1 . '","' . $this->users[$this->uids[$u1]]['align'] . '","' . $this->users[$this->uids[$u1]]['clan'] . '")' [$u1, $rtng1, $this->users[$this->uids[$u1]]['align'], $this->users[$this->uids[$u1]]['clan']]
); );
} }
if ($this->users[$this->uids[$u1]]['bot'] == 0) { if ($this->users[$this->uids[$u1]]['bot'] == 0) {
mysql_query( Db::sql(
'INSERT INTO `users_reting` (`uid`,`time`,`val`,`align`,`clan`) VALUES ( 'insert into users_reting (uid, time, val, align, clan) values (?,unix_timestamp(),?,?,?)',
"' . $u2 . '","' . time() . '","' . $rtng2 . '","' . $this->users[$this->uids[$u2]]['align'] . '","' . $this->users[$this->uids[$u2]]['clan'] . '")' [$u2, $rtng2, $this->users[$this->uids[$u2]]['align'], $this->users[$this->uids[$u2]]['clan']]
); );
} }
} }
} }
$i++; $i++;
} }
} }