Code smell
This commit is contained in:
@@ -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']);
|
||||
|
||||
Reference in New Issue
Block a user