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