diff --git a/classes/battle_new.class.php b/classes/battle_new.class.php
index 36c0f56..94f15a9 100644
--- a/classes/battle_new.class.php
+++ b/classes/battle_new.class.php
@@ -125,8 +125,8 @@ class fbattle
$this->razmen_init($_POST['enemy'], $_POST['attack'], $_POST['defend']);
}
- if (isset($_GET['smena'], $_POST['smena'])) {
- $sm = mysql_fetch_array(mysql_query('SELECT `id`, `login`, `battle`, `bot`, `hp` FROM `users` WHERE `login` = "' . mysql_real_escape_string($_POST['smena']) . '" AND `battle` = "' . $user['battle'] . '" AND `hp` > 0 LIMIT 1'));
+ if (isset($_POST['smena'])) {
+ $sm = db::c()->query('SELECT `id`, `login`, `battle`, `bot`, `hp` FROM `users` WHERE `hp` > 0 AND `login` = "?s" AND `battle` = ?i', $_POST['smena'], $user['battle'])->fetch_assoc();
if (isset($sm['id'])) {
if ($sm['bot'] > 0) {
$bt = mysql_fetch_array(mysql_query('SELECT `id`, `hp` FROM `bots` WHERE `name` = "' . mysql_real_escape_string($_POST['smena']) . '" LIMIT 1'));
@@ -273,7 +273,7 @@ class fbattle
function update_battle()
{
- return mysql_query('UPDATE `battle` SET `exp` = \'' . serialize($this->exp) . '\', `teams` = \'' . serialize($this->battle) . '\', `damage` = \'' . serialize($this->damage) . '\' WHERE `id` = ' . $this->battle_data['id'] . ' ;');
+ return db::c()->query('UPDATE `battle` SET `exp` = "?s", `teams` = "?s", `damage` = "?s", WHERE `id` = ?i', serialize($this->exp), serialize($this->battle), serialize($this->damage), $this->battle_data['id']);
}
/*-------------------------------------------------------------------
@@ -283,13 +283,16 @@ class fbattle
function razmen_init($enemy, $attack, $defend)
{
// проверяем прафильность
- if (($attack == 1 OR $attack == 2 OR $attack == 3 OR $attack == 4 OR $attack == 5) && $defend < 5 && $defend > 0 && $enemy && $this->user['hp'] > 0) {
+ if (in_array($attack,[1,2,3,4,5]) AND in_array($defend,[1,2,3,4]) AND $enemy AND $this->user['hp'] > 0) {
+// if (($attack == 1 OR $attack == 2 OR $attack == 3 OR $attack == 4 OR $attack == 5) && $defend < 5 && $defend > 0 && $enemy && $this->user['hp'] > 0) {
if ($this->battle[$enemy][$this->user['id']][0] > 0) {
// ==================================
- $this->add_log($this->get_comment()); // комментатор
- // х-ки драчующихся
+ # Реплики комментатора:
+ $this->add_log($this->get_comment());
+ # Подсчёт характеристик бойцов:
$mf = $this->solve_mf($enemy, $attack);
// проверяем кто куда попал
+
// удар по мне
$uvorotme = $this->get_chanse($mf['me']['uvorot']);
$krithe = $this->get_chanse($mf['he']['krit']);
diff --git a/zayavka.php b/zayavka.php
index 651531d..08cba56 100644
--- a/zayavka.php
+++ b/zayavka.php
@@ -281,7 +281,7 @@ class zayavka
$range2 = "{$row['t2min']}-{$row['t2max']}";
}
- $rr = "{$row['podan']} {$row['t1c']}({$range1}) (";
+ $rr = "{$row['podan']} {$row['t1c']}({$range1}) (";
foreach ($row['team1'] as $k => $v) {
if ($k != 0) {
$rr .= ", ";
@@ -306,7 +306,7 @@ class zayavka
$rr .= "";
}
- $a = db::c()->query('SELECT `align`,`admin` FROM `users` WHERE `id` = ?i', $user['id'])->fetch_assoc();
+ $a = db::c()->query('SELECT `admin` FROM `users` WHERE `id` = ?i', $user['id'])->fetch_assoc();
$rr .= ") тип боя: ";
if ($row['blood'] && $row['type'] == 4) {
@@ -321,7 +321,7 @@ class zayavka
$rr .= "(таймаут {$row['timeout']} мин.) бой начнется через " . round(($row['start'] - time()) / 60, 1) . " мин. " . (($row['coment']) ? "(" . $row['coment'] . ")" : "") . "";
- if (($a['align'] > 1.4 && $a['align'] < 2) || $a['admin'] == 1) {
+ if ($a['admin'] === 1) {
$rr .= "Удалить комментарий
";
} else {
$rr .= "
";
@@ -374,13 +374,13 @@ class zayavka
$rr .= "(таймаут {$row['timeout']} мин.) бой начнется через " . round(($row['start'] - time()) / 60, 1) . " мин. " . (($row['coment']) ? "(" . $row['coment'] . ")" : "") . "";
- if ($user['admin'] == 1) {
+ if ($user['admin'] === 1) {
$rsr = ' | Удалить заявку';
} else {
$rsr = '';
}
- if (($user['align'] > 1.4 && $user['align'] < 2) || $user['admin'] == 1) {
+ if ($user['admin'] == 1) {
$rr .= "Удалить коммнтарий$rsr
";
} else {
$rr .= "
";
@@ -605,7 +605,7 @@ if (!empty($_POST['open'])) {
fclose($f);
}
?>
-
+