diff --git a/_incl_data/class/Battle.php b/_incl_data/class/Battle.php
index 88b8251c..d6328021 100644
--- a/_incl_data/class/Battle.php
+++ b/_incl_data/class/Battle.php
@@ -1,48 +1,10 @@
users[$this->uids[$u1]]['login']);
- $v_z = 0 + $this->stats[$this->uids[$u2]]['zm' . $type]; //защита цели
- $v_p = 0 + round(
- ($this->stats[$this->uids[$u1]]['pzm' . $type] + $this->stats[$this->uids[$u1]]['pzm']) * 0.4
- ); //подавление защиты от магии
- $v_m = 0 + $this->stats[$this->uids[$u1]]['pm' . $type]; //мощность мага
- //
- return ' magelogin=' . $v_l . ' onMouseOver=top.hi(this,maginfo(' . $v_z . ',' . $v_p . ',' . $v_m . ',this),event,3,1,1,1,null); onMouseOut=top.hic(); onMouseDown=top.hic(); ';
- }
-
- public function typeBattle(int $x): array
- {
- $r = [0, 0, 'Обычный поединок', 'Кровавый Поединок'];
- if ($x >= 50000 && $x < 100000) {
- $r = [25, 50, 'Великая Битва', 'Кровавая Битва'];
- } elseif ($x < 500000) {
- $r = [50, 75, 'Величайшая Битва', 'Кровавая Резня'];
- } elseif ($x < 1000000) {
- $r = [75, 100, 'Историческая Битва', 'Кровавая Сеча'];
- } elseif ($x < 2500000) {
- $r = [100, 125, 'Эпохальная Битва', 'Кровавое Побоище'];
- } elseif ($x >= 5000000) {
- $r = [150, 150, 'Судный День', 'Судный День'];
- }
- return $r;
- }
-
public array $mncolor = [
1 => '006699',
2 => '006699',
@@ -303,107 +265,6 @@ class Battle
305 => ['name' => 'Кровожадность', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3],
];
- //Сохраняем лог в архик
- public function saveLogs($id, $type)
- {
- if ($type == 'all') {
- $type = '';
- mysql_query(
- 'INSERT INTO `battle_logs_save` SELECT `id`,`time`,`battle`,`id_hod`,`text`,`vars`,`zona1`,`zonb1`,`zona2`,`zonb2`,`type` FROM `battle_logs` WHERE `battle` = "' . $this->info['id'] . '" AND `id_hod` <= ' . ($this->hodID) . ''
- );
- } else {
- mysql_query(
- 'INSERT INTO `battle_logs_save` SELECT `id`,`time`,`battle`,`id_hod`,`text`,`vars`,`zona1`,`zonb1`,`zona2`,`zonb2`,`type` FROM `battle_logs` WHERE `battle` = "' . $this->info['id'] . '" AND `id_hod` <= ' . ($this->hodID - 5) . ''
- );
- }
- mysql_query('DELETE FROM `battle_logs` WHERE `battle` = "' . $this->info['id'] . '" ' . $type . '');
- mysql_query('DELETE FROM `battle_stat` WHERE `battle` < "' . ($this->info['id'] - 100) . '" ');
- mysql_query('DELETE FROM `battle_actions` WHERE `btl` = "' . $this->info['id'] . '" ');
-
- }
-
- public function hphe($uid, $hp, $false_t7 = false)
- {
- global $u;
- if (!isset($this->stats[$this->uids[$uid]])) {
- echo 'WARNING! ОШИБКА! ПОТЕРЯНА ПЕРЕМЕННАЯ ЗДОРОВЬЯ ПЕРСОНАЖА!';
- } else {
- $hpnow = floor($this->stats[$this->uids[$uid]]['hpNow']);
- $hpall = $this->stats[$this->uids[$uid]]['hpAll'];
- if ($hp > 0) {
- //Хиляем
- if ($hpnow + $hp > $hpall) {
- $hpli = $hpnow + $hp - $hpall;
- $hp -= $hpli;
- }
- if (isset($this->stats[$this->uids[$uid]]['min_heal_proc']) && $this->stats[$this->uids[$uid]]['min_heal_proc'] < -99) {
- $hp = 0;
- } else {
- $hp = $hp / 100 * (100 + $this->stats[$this->uids[$uid]]['min_heal_proc']);
- }
- //Отнимаем тактику
- if (!$false_t7) {
- if ($this->users[$this->uids[$uid]]['tactic7'] <= 0) {
- $hp = 0;
- $this->users[$this->uids[$uid]]['tactic7'] = 0;
- $this->stats[$this->uids[$uid]]['tactic7'] = $this->users[$this->uids[$uid]]['tactic7'];
- } else {
- $gdhh = round($hp / $this->stats[$this->uids[$uid]]['hpAll'] * 10, 2);
- if ($gdhh == 0) {
- $gdhh = 0.01;
- }
-
- $gdhd = round($this->users[$this->uids[$uid]]['tactic7'] / $gdhh * 100);
-
- $this->users[$this->uids[$uid]]['tactic7'] = round(
- ($this->users[$this->uids[$uid]]['tactic7'] - $gdhh),
- 2
- );
- if ($this->users[$this->uids[$uid]]['tactic7'] < 0) {
- $this->users[$this->uids[$uid]]['tactic7'] = 0;
- }
- $this->stats[$this->uids[$uid]]['tactic7'] = $this->users[$this->uids[$uid]]['tactic7'];
- if ($gdhd < 100) {
- $hp = floor($hp / 100 * $gdhd);
- }
- }
- }
- } elseif ($hp < 0) {
- //Отнимаемф
- if ($hpnow + $hp < 0) {
- $hpli = $hpnow + $hp;
- $hp += -($hpli);
- }
- }
-
- if ($this->stats[$this->uids[$uid]]['hpNow'] < 1) {
- $hp = 0;
- }
-
- $this->stats[$this->uids[$uid]]['last_hp'] = -$hp;
- mysql_query(
- 'UPDATE `stats` SET
- `last_hp` = "' . $this->users[$this->uids[$uid]]['last_hp'] . '",
- `tactic7` = "' . $this->users[$this->uids[$uid]]['tactic7'] . '"
- WHERE `id` = "' . $uid . '" LIMIT 1'
- );
- }
-
- return floor($hp);
- }
-
- public function deleffm(int $pid, int $uid, int $id)
- {
- if ($id > 0) {
- if (!mysql_query('DELETE FROM `eff_users` WHERE `id` = ' . $id . ' AND `v1` = "priem" AND `v2` != 0')) {
- echo '[*Ошибка удаления прием[' . $id . ',' . $pid . ',' . $uid . ']]';
- }
- } else {
- mysql_query('DELETE FROM `eff_users` WHERE `uid` = ' . $uid . ' AND `v1` = "priem" AND `v2` = ' . $pid);
- }
- }
-
-
public $cached = false; //Кэширование данных
public $expCoef = 0; # % опыта в бою
public $aBexp = 0; //Добавочный опыт в боях
@@ -472,14 +333,160 @@ class Battle
4 => ['по <вырезано цензурой>', 'в пах', 'в промежность', 'по левой ягодице', 'по правой ягодице'],
5 => ['по ногам', 'в область правой пятки', 'в область левой пятки', 'по коленной чашечке', 'по икрам'],
]; // Куда лупили
- public $e; //Ошибка (текст)
- public $is = [];
- public $items = [];
+ public string $e; //Ошибка (текст)
+ public array $is = [];
+ public array $items = [];
//Очистка кэша для ...
- public $uclearc = [];
- public $ucleari = [];
+ public array $uclearc = [];
+ public array $ucleari = [];
- public function clear_cache($uid)
+ public function __construct()
+ {
+ ignore_user_abort(true);
+ }
+
+ public function maginfoattack($u1, $u2, $type): string
+ {
+ /*
+ 1 - огонь,
+ 2 - воздух,
+ 3 - вода,
+ 4 - земля
+ */
+ $v_l = str_replace(' ', ' ', $this->users[$this->uids[$u1]]['login']);
+ $v_z = (int)$this->stats[$this->uids[$u2]]['zm' . $type]; //защита цели
+ $v_p = (int)round(
+ (
+ $this->stats[$this->uids[$u1]]['pzm' . $type] +
+ $this->stats[$this->uids[$u1]]['pzm']
+ )
+ * 0.4
+ ); //подавление защиты от магии
+ $v_m = (int)$this->stats[$this->uids[$u1]]['pm' . $type]; //мощность мага
+ //
+ return ' magelogin=' . $v_l . ' onMouseOver=top.hi(this,maginfo(' . $v_z . ',' . $v_p . ',' . $v_m . ',this),event,3,1,1,1,null); onMouseOut=top.hic(); onMouseDown=top.hic(); ';
+ }
+
+ private function typeBattle(int $x): array
+ {
+ $r = [0, 0, 'Обычный поединок', 'Кровавый Поединок'];
+ if ($x >= 50000 && $x < 100000) {
+ $r = [25, 50, 'Великая Битва', 'Кровавая Битва'];
+ } elseif ($x < 500000) {
+ $r = [50, 75, 'Величайшая Битва', 'Кровавая Резня'];
+ } elseif ($x < 1000000) {
+ $r = [75, 100, 'Историческая Битва', 'Кровавая Сеча'];
+ } elseif ($x < 2500000) {
+ $r = [100, 125, 'Эпохальная Битва', 'Кровавое Побоище'];
+ } elseif ($x >= 5000000) {
+ $r = [150, 150, 'Судный День', 'Судный День'];
+ }
+ return $r;
+ }
+
+ /**
+ * Сохраняем лог в архив
+ * @return void
+ */
+ private function saveLogs()
+ {
+ Db::sql(
+ 'insert into battle_logs_save select id, time, battle, id_hod, text, vars, zona1, zonb1, zona2, zonb2, type from battle_logs where battle = ? and id_hod <= ?',
+ [$this->info['id'], $this->hodID]
+ );
+ Db::sql('delete from battle_logs where battle = ?', [$this->info['id']]);
+ Db::sql('delete from battle_stat where battle < ?', [$this->info['id'] - 100]);
+ Db::sql('delete from battle_actions where btl = ?', [$this->info['id']]);
+ }
+
+ public function hphe($uid, $hp, $false_t7 = false)
+ {
+ global $u;
+ if (!isset($this->stats[$this->uids[$uid]])) {
+ echo 'WARNING! ОШИБКА! ПОТЕРЯНА ПЕРЕМЕННАЯ ЗДОРОВЬЯ ПЕРСОНАЖА!';
+ } else {
+ $hpnow = floor($this->stats[$this->uids[$uid]]['hpNow']);
+ $hpall = $this->stats[$this->uids[$uid]]['hpAll'];
+ if ($hp > 0) {
+ //Хиляем
+ if ($hpnow + $hp > $hpall) {
+ $hpli = $hpnow + $hp - $hpall;
+ $hp -= $hpli;
+ }
+ if (isset($this->stats[$this->uids[$uid]]['min_heal_proc']) && $this->stats[$this->uids[$uid]]['min_heal_proc'] < -99) {
+ $hp = 0;
+ } else {
+ $hp = $hp / 100 * (100 + $this->stats[$this->uids[$uid]]['min_heal_proc']);
+ }
+ //Отнимаем тактику
+ if (!$false_t7) {
+ if ($this->users[$this->uids[$uid]]['tactic7'] <= 0) {
+ $hp = 0;
+ $this->users[$this->uids[$uid]]['tactic7'] = 0;
+ $this->stats[$this->uids[$uid]]['tactic7'] = $this->users[$this->uids[$uid]]['tactic7'];
+ } else {
+ $gdhh = round($hp / $this->stats[$this->uids[$uid]]['hpAll'] * 10, 2);
+ if ($gdhh == 0) {
+ $gdhh = 0.01;
+ }
+
+ $gdhd = round($this->users[$this->uids[$uid]]['tactic7'] / $gdhh * 100);
+
+ $this->users[$this->uids[$uid]]['tactic7'] = round(
+ ($this->users[$this->uids[$uid]]['tactic7'] - $gdhh),
+ 2
+ );
+ if ($this->users[$this->uids[$uid]]['tactic7'] < 0) {
+ $this->users[$this->uids[$uid]]['tactic7'] = 0;
+ }
+ $this->stats[$this->uids[$uid]]['tactic7'] = $this->users[$this->uids[$uid]]['tactic7'];
+ if ($gdhd < 100) {
+ $hp = floor($hp / 100 * $gdhd);
+ }
+ }
+ }
+ } elseif ($hp < 0) {
+ //Отнимаемф
+ if ($hpnow + $hp < 0) {
+ $hpli = $hpnow + $hp;
+ $hp += -($hpli);
+ }
+ }
+
+ if ($this->stats[$this->uids[$uid]]['hpNow'] < 1) {
+ $hp = 0;
+ }
+
+ $this->stats[$this->uids[$uid]]['last_hp'] = -$hp;
+ Db::sql(
+ 'update stats set last_hp = ?, tactic7 = ? where id = ?', [
+ $this->users[$this->uids[$uid]]['last_hp'],
+ $this->users[$this->uids[$uid]]['tactic7'],
+ $uid,
+ ]
+ );
+ }
+
+ return floor($hp);
+ }
+
+ /**
+ * Какая-то хуедрыга для номерных файлов-приёмов
+ * @param int $pid
+ * @param int $uid
+ * @param int $id
+ * @return void
+ */
+ public function deleffm(int $pid, int $uid, int $id)
+ {
+ if ($id > 0) {
+ Db::sql('delete from eff_users where id = ? and v1 = ? and v2 != 0', [$id, 'priem']);
+ } else {
+ Db::sql('delete from eff_users where uid = ? and v1 = ? and v2 = ?', [$uid, 'priem', $pid]);
+ }
+ }
+
+ private function clearСache($uid)
{
if ($uid > 0 && !isset($this->uclearc[$uid])) {
$this->uclearc[$uid] = true;
@@ -489,156 +496,106 @@ class Battle
public function clear_cache_start()
{
- $i = 0;
- while ($i < count($this->ucleari)) {
- mysql_query(
- 'DELETE FROM `battle_cache` WHERE `uid` = "' . mysql_real_escape_string($this->ucleari[$i]) . '"'
- );
- $i++;
- }
+ $uids = implode(',', $this->ucleari);
+ Db::sql('delete from battle_cache where uid in (?)', [$uids]);
}
- //Проверка урон приемов над защитными
- public function testYronPriemAttack($pid, $u1, $u2, $hp)
+ //
+
+ /**
+ * Проверка урон приемов над защитными.
+ * Игрок 1 бьет по Игроку 2 при помощи приема на hp ед. здоровья.
+ * @param $u2
+ * @param $hp
+ * @return mixed
+ */
+ public function testYronPriemAttack($u2, $hp)
{
- //Игрок 1 бьет по Игроку 2 при помощи приема № pid на hp ед. здоровья
-
- /*
- Полная защита
- */
//Получаем приемы и смотрим когда какой действует
- $eff = $this->stats[$this->uids[$u2]]['effects'];
- $j = 0;
- while ($j <= count($eff)) {
- if (isset($eff[$j]) && $eff[$j]['id_eff'] == 22 && $eff[$j]['v1'] == 'priem' && $eff[$j]['v2'] > 0) {
- // id прием $eff[$j]['v2']
- if ($eff[$j]['v2'] == 140 || $eff[$j]['v2'] == 211 || $eff[$j]['v2'] == 45) { //|| $eff[$j]['v2'] == 45
- //Приемы от которых урон = 1 , то есть выдаем 0
- $hp['y'] = -1;
- $hp['r'] = 1;
- $hp['k'] = 2;
- $hp['m_y'] = 1;
- $hp['m_k'] = 2;
- }
+ foreach ($this->stats[$this->uids[$u2]]['effects'] as $effect) {
+ if (
+ isset($effect) &&
+ $effect['id_eff'] == 22 &&
+ $effect['v1'] == 'priem' &&
+ (
+ $effect['v2'] == 140 ||
+ $effect['v2'] == 211 ||
+ $effect['v2'] == 45
+ )
+ ) {
+ //Приемы от которых урон = 1 , то есть выдаем 0
+ $hp['y'] = -1;
+ $hp['r'] = 1;
+ $hp['k'] = 2;
+ $hp['m_y'] = 1;
+ $hp['m_k'] = 2;
}
- $j++;
}
- unset($eff);
-
return $hp;
}
- //Расчет маг.крита
- public function magKrit($l2, $t)
+ /**
+ * Расчет опыта
+ * @param $y
+ * @param $s2
+ * @return int
+ */
+ private function testExp($y, $s2): int
{
- $r = 0;
- $r = $l2 * 2 - 7;
- if ($r > $t) {
- //магический промах (серый удар, в 2 раза меньше) 6%
- //250 ед. защиты от магии дает 1% шанса увернуться от магии
- //$r = -1; , промах --
- $r = 0;
- } else {
- //каждая владелка дает 3% шанс крита
- $r = ceil($t * 0.75);
- if ($r > 30) {
- $r = 30;
- }
- if (rand(0, 10000) < $r * 100) {
- //крит удар
- $r = 1;
- } else {
- $r = 0;
- }
+ if ($s2['levels'] == 'undefined' || $this->users[$this->uids[$s2['id']]]['pass'] == 'saintlucia') {
+ return 0;
}
- return $r;
- }
-
- //Расчет опыта
- public function testExp($y, $s1, $s2, $id1, $id2)
- {
- global $u, $c;
-
- //ТУТ таблица умножения оыта
- $oplevel = [ // Максимум для каждого уровня.
- 0 => 1,
- 1 => 1,
- 2 => 1,
- 3 => 1,
- 4 => 2,
- 5 => 2,
- 6 => 2,
- 7 => 2,
- 8 => 3,
- 9 => 4,
- 10 => 5,
- 11 => 6,
- 12 => 7,
- 13 => 50,
- 14 => 75,
- ];
-
- if ($y < 0) {
- $y = 0;
+ $y = max(0, (int)$y);
+ $expmultiplier = 1;
+ if ($this->users[$this->uids[$s2['id']]]['level'] >= 8) {
+ $expmultiplier = $this->users[$this->uids[$s2['id']]]['level'] - 5;
}
+
if ($s2['hpNow'] < 0) {
$y = 0;
}
if ($s2['hpNow'] < $y) {
- $y = $s2['hpNow'];
+ $y = max(0, $s2['hpNow']);
}
- if ($y < 0) {
- $y = 0;
- }
- $addExp = 0 + ($y * $oplevel[$this->users[$this->uids[$s2['id']]]['level']]);
+ $addExp = $y * $expmultiplier;
if ($s2['hpAll'] - $y <= 0) {
$addExp = 100;
}
-
- if ($addExp < 0) {
- $addExp = 0;
- }
- if ($s2['levels'] != 'undefined' && $this->users[$this->uids[$s2['id']]]['pass'] != 'saintlucia') {
-
- if ($doexp < 0) {
- $doexp = 0;
+ if ($this->info['razdel'] != 5 && Config::get('exp_limit_many')) {
+ $texp = Db::getValue(
+ 'select count(*) from battle_users as a where uid = ? and battle in (select battle from battle_users where uid = ? and team != a.team and time_enter > unix_timestamp() - 86400)'
+ );
+ //
+ if ($texp > 5) {
+ $addExp = 0;
+ } elseif ($texp > 4) {
+ $addExp = $addExp * 0.50;
+ } elseif ($texp > 3) {
+ $addExp = $addExp * 0.75;
+ } elseif ($texp > 2) {
+ $addExp = $addExp * 1.00;
+ } elseif ($texp > 1) {
+ $addExp = $addExp * 1.00;
+ } else {
+ $addExp = $addExp * 1.00;
}
-
- if ($this->info['razdel'] != 5 && $c['exp_limit_many'] == true) {
- $texp = mysql_fetch_array(
- mysql_query(
- 'SELECT COUNT(`a`.`id`) FROM `battle_users` AS `a` WHERE `a`.`uid` = "' . $id1 . '" AND `a`.`battle` IN ( SELECT `b`.`battle` FROM `battle_users` AS `b` WHERE `b`.`uid` = "' . $id2 . '" AND `b`.`team` != `a`.`team` AND `b`.`time` > "' . (time(
- ) - 86400) . '" ) LIMIT 1'
- )
- );
- $texp = $texp[0];
- //
- if ($texp > 5) {
- $addExp = $addExp * 0.00;
- } elseif ($texp > 4) {
- $addExp = $addExp * 0.50;
- } elseif ($texp > 3) {
- $addExp = $addExp * 0.75;
- } elseif ($texp > 2) {
- $addExp = $addExp * 1.00;
- } elseif ($texp > 1) {
- $addExp = $addExp * 1.00;
- } else {
- $addExp = $addExp * 1.00;
- }
- }
- unset($doexp);
- } else {
- $addExp = 0;
}
-
-
- return $addExp;
+ return (int)round($addExp);
}
- //Добавляем опыт \ нанесенный урон
+ /**
+ * Добавляем опыт \ нанесенный урон.
+ * Кривовсрато, на переделку.
+ * @param $id
+ * @param $y
+ * @param $id1
+ * @param $id2
+ * @param $mgregen
+ * @param $nobattle_uron
+ * @return void
+ */
public function takeExp($id, $y, $id1, $id2, $mgregen = false, $nobattle_uron = false)
{
global $u;
@@ -646,12 +603,11 @@ class Battle
$s1 = $this->stats[$this->uids[$id1]];
$s2 = $this->stats[$this->uids[$id2]];
if ($id1 != $id2) {
- $e = $this->testExp($y, $s1, $s2, $id1, $id2);
+ $e = $this->testExp($y, $s2);
} else {
$e = 0;
}
-
if ((int)$this->users[$this->uids[$id1]]['bot_id'] == 0 && $this->users[$this->uids[$id1]]['dnow'] != 0 && $this->info['dungeon'] != 1) {
$dun_limitForLevel = [ // Максимум для каждого уровня.
4 => 750,
@@ -685,12 +641,10 @@ class Battle
}
if ($this->info['dungeon'] > 1 && $this->users[$this->uids[$id1]]['battle'] > 0) { // пещерный лимит
$dun_exp = []; // Текущий лимит опыта игрока в подземельях.
- $rep = mysql_fetch_array(
- mysql_query(
- 'SELECT `dungeonexp`,`id` FROM `rep` WHERE `id` = "' . $this->users[$this->uids[$id1]]['id'] . '" LIMIT 1'
- )
+ $rep = Db::getValue(
+ 'select dungeonexp from rep where id = ?', [$this->users[$this->uids[$id1]]['id']]
);
- $rep = explode(',', $rep['dungeonexp']);
+ $rep = explode(',', $rep);
foreach ($rep as $key => $val) {
$val = explode('=', $val);
if (isset($val[0]) && isset($val[1]) && $val[0] != '' && $val[1] != 0) {
@@ -723,7 +677,6 @@ class Battle
$dun_exp[$this->info['dungeon']] += $e;
} elseif ($dun_limitForLevel[(int)$this->users[$this->uids[$id1]]['level']] > ($dun_exp[$this->info['dungeon']] + $e)) {
// Если опыта недостаточно, для достижения лимита.
- $e = $e;
$dun_exp[$this->info['dungeon']] += $e;
} else {
$e = 0;
@@ -764,26 +717,29 @@ class Battle
}
}
-
- $upd = mysql_query(
- 'UPDATE `stats` SET `last_hp` = "' . $this->users[$this->uids[$id1]]['last_hp'] . '",`tactic6` = "' . $this->users[$this->uids[$id1]]['tactic6'] . '",`battle_yron` = "' . $this->users[$this->uids[$id1]]['battle_yron'] . '",`battle_exp` = "' . $this->users[$this->uids[$id1]]['battle_exp'] . '" WHERE `id` = "' . ((int)$id1) . '" LIMIT 1'
+ Db::sql(
+ 'update stats set last_hp = ?, tactic6 = ?, battle_yron = ?, battle_exp = ? where id = ?', [
+ $this->users[$this->uids[$id1]]['last_hp'],
+ $this->users[$this->uids[$id1]]['tactic6'],
+ $this->users[$this->uids[$id1]]['battle_yron'],
+ $this->users[$this->uids[$id1]]['battle_exp'],
+ (int)$id1,
+ ]
);
- if (!$upd) {
- echo '[не удача при использовании приема]';
- } else {
- $this->stats[$this->uids[$id1]]['battle_exp'] = $this->users[$this->uids[$id1]]['battle_exp'];
- $this->clear_cache($id1);
- $this->stats[$this->uids[$id1]]['tactic6'] = $this->users[$this->uids[$id1]]['tactic6'];
- if ($id1 == $u->info['id']) {
- $u->info['tactic6'] = $this->users[$this->uids[$id1]]['tactic6'];
- $u->stats['tactic6'] = $this->users[$this->uids[$id1]]['tactic6'];
- $u->info['battle_exp'] = $this->users[$this->uids[$id1]]['battle_exp'];
- $u->info['battle_yron'] = $this->users[$this->uids[$id1]]['battle_yron'];
- $u->info['notactic'] = $this->users[$this->uids[$id1]]['notactic'];
- $u->stats['notactic'] = $this->users[$this->uids[$id1]]['notactic'];
- }
+
+ $this->stats[$this->uids[$id1]]['battle_exp'] = $this->users[$this->uids[$id1]]['battle_exp'];
+ $this->clearСache($id1);
+ $this->stats[$this->uids[$id1]]['tactic6'] = $this->users[$this->uids[$id1]]['tactic6'];
+ if ($id1 == $u->info['id']) {
+ $u->info['tactic6'] = $this->users[$this->uids[$id1]]['tactic6'];
+ $u->stats['tactic6'] = $this->users[$this->uids[$id1]]['tactic6'];
+ $u->info['battle_exp'] = $this->users[$this->uids[$id1]]['battle_exp'];
+ $u->info['battle_yron'] = $this->users[$this->uids[$id1]]['battle_yron'];
+ $u->info['notactic'] = $this->users[$this->uids[$id1]]['notactic'];
+ $u->stats['notactic'] = $this->users[$this->uids[$id1]]['notactic'];
}
- unset($s1, $s2);
+
+
}
}
@@ -801,355 +757,344 @@ class Battle
$u->info['battle_yron'] += $y;
$u->stats['battle_yron'] += $y;
}
- mysql_query("UPDATE stats SET battle_yron = battle_yron + $y WHERE id = " . $uid);
+ Db::sql('update stats set battle_yron = battle_yron + ? where id = ?', [$y, $uid]);
}
//JS информация о игроке
public function myInfo($id, $t)
{
global $c, $u;
- if (isset($this->users[$this->uids[$id]]) || $u->info['id'] == $id) {
- if ($u->info['id'] == $id || ($u->info['enemy'] == $id && $id > 0)) {
- //Всегда обновляем
- $this->users[$this->uids[$id]] = mysql_fetch_array(
- mysql_query(
- 'SELECT
-
- `u`.`zag`,`u`.`id`,`u`.`login`,`u`.`login2`,`u`.`online`,`u`.`admin`,`u`.`city`,`u`.`cityreg`,`u`.`align`,`u`.`align_lvl`,`u`.`align_exp`,`u`.`clan`,
- `u`.`level`,`u`.`money`,`u`.`money3`,`u`.`money2`,`u`.`money4`,`u`.`battle`,`u`.`sex`,`u`.`obraz`,`u`.`win`,`u`.`win_t`,
- `u`.`lose`,`u`.`lose_t`,`u`.`nich`,`u`.`timeMain`,`u`.`invis`,`u`.`bot_id`,`u`.`animal`,`u`.`type_pers`,
- `u`.`notrhod`,`u`.`bot_room`,`u`.`inUser`,`u`.`inTurnir`,`u`.`inTurnirnew`,`u`.`stopexp`,`u`.`real`,
-
- `st`.*
-
- FROM `users` AS `u` LEFT JOIN `stats` AS `st` ON (`u`.`id` = `st`.`id`) WHERE `u`.`id` = "' . $id . '" LIMIT 1'
- )
- );
- $this->stats[$this->uids[$id]] = $u->getStats($this->users[$this->uids[$id]], 0, 0, false, false, true);
- $this->stats[$this->uids[$id]]['items'] = $this->stats[$this->uids[$id]]['items'];
- $this->stats[$this->uids[$id]]['effects'] = $this->stats[$this->uids[$id]]['effects'];
-
- }
-
-
- $ur = $this->users[$this->uids[$id]];
- $st = $this->stats[$this->uids[$id]];
- $itm = $this->stats[$this->uids[$id]]['items'];
- $eff = $this->stats[$this->uids[$id]]['effects'];
- $ef = '';
- $i = 0;
- if ($u->info['seff'] < 1) {
- $ef .= '
Свернуть\',event,3,1,1,1,\'\');\" onmouseout=\"top.hic();\" onmousedown=\"top.hic();\">
';
-
- while ($i != -1) {
- $nseef = 0;
- if ($this->users[$this->uids[$ur['id']]]['id'] != $u->info['id'] && $ur['id'] != 0) {
- if ($this->stats[$this->uids[$ur['id']]]['seeAllEff'] != 1) {
- $nseef = 1;
- if ($eff[$i]['v1'] == 'priem') {
- $eff[$i]['priem'] = mysql_fetch_array(
- mysql_query('SELECT * FROM `priems` WHERE `id` = "' . $eff[$i]['v2'] . '" LIMIT 1')
- );
- }
- if (isset($eff[$i]['priem']['id']) && $eff[$i]['priem']['neg'] == 1) {
- $nseef = 0;
- }
- }
- }
-
- if (isset($eff[$i]) && $eff[$i] != 'delete') {
- if ($nseef == 0) {
- $ei = '' . $eff[$i]['name'] . '';
- if ($eff[$i]['x'] > 1) {
- $ei .= ' x' . $eff[$i]['x'] . ' ';
- }
- if ($eff[$i]['type1'] > 0 && $eff[$i]['type1'] < 7) {
- $ei .= ' (Эликсир)';
- } elseif (($eff[$i]['type1'] > 6 && $eff[$i]['type1'] < 11) || $eff[$i]['type1'] == 16) {
- $ei .= ' (Заклятие)';
- } elseif ($eff[$i]['type1'] == 14) {
- $ei .= ' (Прием)';
- } elseif ($eff[$i]['type1'] == 15) {
- $ei .= ' (Изучение)';
- } elseif ($eff[$i]['type1'] == 17) {
- $ei .= ' (Проклятие)';
- } elseif ($eff[$i]['type1'] == 18 || $eff[$i]['type1'] == 19) {
- $ei .= ' (Травма)';
- } elseif ($eff[$i]['type1'] == 20) {
- $ei .= ' (Пристрастие)';
- } elseif ($eff[$i]['type1'] == 22) {
- $ei .= ' (Ожидание)';
- } else {
- $ei .= ' (Эффект)';
- }
- $ei .= '
';
-
- $out = '';
- $time_still = ($eff[$i]['timeUse'] + ($eff[$i]['timeAce'] - $eff[$i]['timeUse']) + $eff[$i]['actionTime']);
- if ($eff[$i]['timeAce'] == 0) {
- $time_still += $eff[$i]['timeUse'];
- }
- $time_still -= time();
- if ($eff[$i]['bp'] == 0 && $eff[$i]['timeUse'] != 77) {
- if ($eff[$i]['type1'] != 13) {
-
- $ei .= 'Осталось: ' . $u->timeOut($time_still) . '';
- }
- } else {
- if ($eff[$i]['timeUse'] != 77 && $eff[$i]['hod'] < 1) {
- $ei .= 'Осталось: ' . $u->timeOut($time_still) . '';
- //$ei .= 'Зарядов: '.$out.'
';
- } elseif ($eff[$i]['hod'] >= 0) {
- $ei .= 'Зарядов: ' . $eff[$i]['hod'] . '';
- }
- }
-
- if ($eff[$i]['user_use'] != '') {
- if ($this->users[$this->uids[$eff[$i]['user_use']]]['login2'] != '') {
- $ei .= '
Автор: ' . $this->users[$this->uids[$eff[$i]['user_use']]]['login2'] . '';
- } elseif ($this->users[$this->uids[$eff[$i]['user_use']]]['login'] != '') {
- $ei .= '
Автор: ' . $this->users[$this->uids[$eff[$i]['user_use']]]['login'] . '';
- }
- }
-
- //Действие эффекта
- $tr = '';
- $ti = $u->items['add'];
- $x = 0;
- $ed = $u->lookStats($eff[$i]['data']);
- while ($x < count($ti)) {
- $n = $ti[$x];
- if (isset($ed['add_' . $n], $u->is[$n]) && $n != 'pog') {
- $z = '';
- if ($ed['add_' . $n] > 0) {
- $z = '+';
- }
- $tr .= '
' . $u->is[$n] . ': ' . $z . '' . $ed['add_' . $n];
- }
- $x++;
- }
-
- if ($ed['add_mib1'] != 0) {
- if ($ed['add_mab1'] != 0) {
- $tr .= '
Броня головы: ' . $ed['add_mib1'] . '-' . $ed['add_mab1'] . '';
- } else {
- $m1l = $ed['add_mib1'];
- if ($m1l > 0) {
- $m1l = '+' . $m1l;
- }
- $tr .= '
Броня головы: ' . $m1l . '';
- }
- }
- if ($ed['add_mib2'] != 0) {
- if ($ed['add_mab2'] != 0) {
- $tr .= '
Броня корпуса: ' . $ed['add_mib2'] . '-' . $ed['add_mab2'] . '';
- } else {
- $m1l = $ed['add_mib2'];
- if ($m1l > 0) {
- $m1l = '+' . $m1l;
- }
- $tr .= '
Броня корпуса: ' . $m1l . '';
- }
- }
- if ($ed['add_mib3'] != 0) {
- if ($ed['add_mab3'] != 0) {
- $tr .= '
Броня пояса: ' . $ed['add_mib3'] . '-' . $ed['add_mab3'] . '';
- } else {
- $m1l = $ed['add_mib3'];
- if ($m1l > 0) {
- $m1l = '+' . $m1l;
- }
- $tr .= '
Броня пояса: ' . $m1l . '';
- }
- }
- if ($ed['add_mib4'] != 0) {
- if ($ed['add_mab4'] != 0) {
- $tr .= '
Броня ног: ' . $ed['add_mib4'] . '-' . $ed['add_mab4'] . '';
- } else {
- $m1l = $ed['add_mib4'];
- if ($m1l > 0) {
- $m1l = '+' . $m1l;
- }
- $tr .= '
Броня ног: ' . $m1l . '';
- }
- }
-
- $efix = 0;
- if (isset($ed['add_pog2']) && $ed['add_pog2'] > 0) {
- $efix = $ed['add_pog2'];
- }
- if (isset($ed['add_pog'])) {
- $tr .= '
Магический барьер способен поглотить еще ' . $ed['add_pog'] . ' ед. урона';
- }
- if (isset($ed['add_pog2'])) {
- $tr .= '
Магический барьер способен поглотить еще ' . $ed['add_pog2'] . ' ед. урона (' . $ed['add_pog2p'] . '%)';
- }
-
- if ($tr != '') {
- $ei .= $tr;
- }
- if ($eff[$i]['info'] != '') {
- $ei .= '
Информация:
' . $eff[$i]['info'];
- }
-
- $ef .= '';
- unset($efix);
- }
- } elseif ($eff[$i] != 'delete') {
- $i = -2;
- }
- $i++;
- }
- } else {
- $ef .= 'Развернуть\',event,3,1,1,1,\'\');\" onmouseout=\"top.hic();\" onmousedown=\"top.hic();\">
';
- }
-
- $ca = '';
- if ($ur['clan'] > 0) {
- $cl = mysql_fetch_array(mysql_query('SELECT * FROM `clan` WHERE `id` = "' . $ur['clan'] . '" LIMIT 1'));
- if (isset($cl['id'])) {
- $ca = '';
- }
- }
- if ($ur['align'] > 0) {
- $ca = '' . $ca;
- }
- if ($ur['login2'] == '') {
- $ur['login2'] = $ur['login'];
- }
- if (floor($st['hpNow']) > $st['hpAll']) {
- $st['hpNow'] = $st['hpAll'];
- }
- if (floor($st['mpNow']) > $st['mpAll']) {
- $st['mpNow'] = $st['mpAll'];
- }
- $stsua = '' . $ur['login2'] . '';
- $stsua .= '
Сила: ' . $st['s1'];
- $stsua .= '
Ловкость: ' . $st['s2'];
- $stsua .= '
Интуиция: ' . $st['s3'];
- $stsua .= '
Выносливость: ' . $st['s4'];
- if ($st['s5'] != 0) {
- $stsua .= '
Интелект: ' . $st['s5'];
- }
- if ($st['s6'] != 0) {
- $stsua .= '
Мудрость: ' . $st['s6'];
- }
- if ($st['s7'] != 0) {
- $stsua .= '
Духовность: ' . $st['s7'];
- }
- if ($u->info['admin'] > 0) {
- $align = $ur['align'];
- }
- $tp_img = [
- 1 => 4,
- 2 => 5,
- 14 => 6,
- 3 => 7,
- 5 => 8,
- 7 => 9,
- 17 => 10,
- 16 => 11,
- 13 => 12,
- 10 => 13,
- 9 => 14,
- 8 => 15,
- 11 => 17, //кольцо 2
- 12 => 18, //кольцо 3
- ];
- $info = 'info_reflesh(' . $t . ',' . $ur['id'] . ',"' . $ca . '' . $ur['login2'] . ' [' . $ur['level'] . '] ","' . $ur['obraz'] . '",' . floor(
- $st['hpNow']
- ) . ',' . floor($st['hpAll']) . ',' . floor($st['mpNow']) . ',' . floor(
- $st['mpAll']
- ) . ',0,' . $ur['sex'] . ',"' . $ef . '","' . $stsua . '", "' . $align . '", "' . $ur['zag'] . '");shpb();';
- $i = 0;
- if (is_array($itm)) {
- while ($i < count($itm)) {
- //
- if (isset($st['items_img'][$tp_img[$itm[$i]['inOdet']]])) {
- $itm[$i]['img'] = $st['items_img'][$tp_img[$itm[$i]['inOdet']]];
- }
- //генерируем предметы
- $ttl = '' . $itm[$i]['name'] . '';
- $td = $u->lookStats($itm[$i]['data']);
- $lvar = '';
- if ($td['add_hpAll'] > 0) {
- $td['add_hpAll'] = '+' . $td['add_hpAll'];
- $lvar .= '
Уровень жизни: ' . $td['add_hpAll'] . '';
- }
- if ($td['sv_yron_max'] > 0 || $td['sv_yron_min'] > 0) {
- $lvar .= '
Урон: ' . (0 + $td['sv_yron_min']) . '-' . (0 + $td['sv_yron_max']) . '';
- }
- if ($td['add_mab1'] > 0) {
- if ($td['add_mib1'] == $td['add_mab1'] && $pl['geniration'] == 1) {
- $m1l = '+';
- $lvar .= '
Броня головы: ' . $m1l . '' . (0 + $td['add_mab1']) . '';
- } else {
- $lvar .= '
Броня головы: ' . (0 + $td['add_mib1']) . '-' . (0 + $td['add_mab1']) . '';
- }
- }
- if ($td['add_mab2'] > 0) {
- if ($td['add_mib2'] == $td['add_mab2'] && $pl['geniration'] == 1) {
- $m1l = '+';
- $lvar .= '
Броня корпуса: ' . $m1l . '' . (0 + $td['add_mab2']) . '';
- } else {
- $lvar .= '
Броня корпуса: ' . (0 + $td['add_mib2']) . '-' . (0 + $td['add_mab2']) . '';
- }
- }
- if ($td['add_mab3'] > 0) {
- if ($td['add_mib3'] == $td['add_mab3'] && $pl['geniration'] == 1) {
- $m1l = '+';
- $lvar .= '
Броня пояса: ' . $m1l . '' . (0 + $td['add_mab3']) . '';
- } else {
- $lvar .= '
Броня пояса: ' . (0 + $td['add_mib3']) . '-' . (0 + $td['add_mab3']) . '';
- }
- }
- if ($td['add_mab4'] > 0) {
- if ($td['add_mib4'] == $td['add_mab4'] && $pl['geniration'] == 1) {
- $m1l = '+';
- $lvar .= '
Броня ног: ' . $m1l . '' . (0 + $td['add_mab4']) . '';
- } else {
- $lvar .= '
Броня ног: ' . (0 + $td['add_mib4']) . '-' . (0 + $td['add_mab4']) . '';
- }
- }
- if ($itm[$i]['iznosMAX'] > 0) {
- if ($itm[$i]['iznosMAXi'] == 999999999) {
- $lvar .= '
Долговечность: неразрушимо';
- } else {
- $lvar .= '
Долговечность: ' . floor($itm[$i]['iznosNOW']) . '/' . floor(
- $itm[$i]['iznosMAX']
- );
- }
- }
- $ttl .= $lvar;
- $ccv = '';
-
- if ($itm[$i]['magic_inci'] != '' || $itm[$i]['magic_inc'] != '') {
- if ($itm[$i]['magic_inc'] == '') {
- $itm[$i]['magic_inc'] = $itm[$i]['magic_inci'];
- }
- $mgi = mysql_fetch_array(
- mysql_query(
- 'SELECT * FROM `eff_main` WHERE `id2` = "' . $itm[$i]['magic_inc'] . '" AND `type1` = "12345" LIMIT 1'
- )
- );
- if (isset($mgi['id2'])) {
- $mgilog = '';
- $ccv .= 'top.useMagicBattle(\'' . $mgi['mname'] . '\',' . $itm[$i]['id'] . ',\'' . $mgi['img'] . '\',1,2);';
- }
- }
-
- $info .= 'abitms(' . (0 + $t) . ',' . (0 + $itm[$i]['uid']) . ',' . (0 + $itm[$i]['id']) . ',' . (0 + $itm[$i]['inOdet']) . ',"' . $itm[$i]['name'] . '","' . $ttl . '","' . $itm[$i]['img'] . '","' . $ccv . '");';
- $i++;
- }
- }
-
- return $info;
- } else {
+ if (!isset($this->users[$this->uids[$id]]) && $u->info['id'] != $id) {
return false;
}
+ if ($u->info['id'] == $id || ($u->info['enemy'] == $id && $id > 0)) {
+ //Всегда обновляем
+ $this->users[$this->uids[$id]] = Db::getRow('select u.zag,u.id,u.login,u.login2,u.online,u.admin,u.city,u.cityreg,u.align,u.align_lvl,u.align_exp,u.clan,
+ u.level,u.money,u.money3,u.money2,u.money4,u.battle,u.sex,u.obraz,u.win,u.win_t,
+ u.lose,u.lose_t,u.nich,u.timeMain,u.invis,u.bot_id,u.animal,u.type_pers,
+ u.notrhod,u.bot_room,u.inUser,u.inTurnir,u.inTurnirnew,u.stopexp,u.real, s.* from users as u left join stats as s on (u.id = s.id) where u.id = ?', [$id]);
+
+ $this->stats[$this->uids[$id]] = $u->getStats($this->users[$this->uids[$id]], 0, 0, false, false, true);
+ $this->stats[$this->uids[$id]]['items'] = $this->stats[$this->uids[$id]]['items'];
+ $this->stats[$this->uids[$id]]['effects'] = $this->stats[$this->uids[$id]]['effects'];
+
+ }
+ $ur = $this->users[$this->uids[$id]];
+ $st = $this->stats[$this->uids[$id]];
+ $itm = $this->stats[$this->uids[$id]]['items'];
+ $eff = $this->stats[$this->uids[$id]]['effects'];
+ $ef = '';
+ $i = 0;
+ if ($u->info['seff'] < 1) {
+ $ef .= 'Свернуть\',event,3,1,1,1,\'\');\" onmouseout=\"top.hic();\" onmousedown=\"top.hic();\">
';
+
+ while ($i != -1) {
+ $nseef = 0;
+ if ($this->users[$this->uids[$ur['id']]]['id'] != $u->info['id'] && $ur['id'] != 0) {
+ if ($this->stats[$this->uids[$ur['id']]]['seeAllEff'] != 1) {
+ $nseef = 1;
+ if ($eff[$i]['v1'] == 'priem') {
+ $eff[$i]['priem'] = Db::getRow('select * from priems where id = ?', [$eff[$i]['v2']]);
+
+ }
+ if (isset($eff[$i]['priem']['id']) && $eff[$i]['priem']['neg'] == 1) {
+ $nseef = 0;
+ }
+ }
+ }
+
+ if (isset($eff[$i]) && $eff[$i] != 'delete') {
+ if ($nseef == 0) {
+ $ei = '' . $eff[$i]['name'] . '';
+ if ($eff[$i]['x'] > 1) {
+ $ei .= ' x' . $eff[$i]['x'] . ' ';
+ }
+ if ($eff[$i]['type1'] > 0 && $eff[$i]['type1'] < 7) {
+ $ei .= ' (Эликсир)';
+ } elseif (($eff[$i]['type1'] > 6 && $eff[$i]['type1'] < 11) || $eff[$i]['type1'] == 16) {
+ $ei .= ' (Заклятие)';
+ } elseif ($eff[$i]['type1'] == 14) {
+ $ei .= ' (Прием)';
+ } elseif ($eff[$i]['type1'] == 15) {
+ $ei .= ' (Изучение)';
+ } elseif ($eff[$i]['type1'] == 17) {
+ $ei .= ' (Проклятие)';
+ } elseif ($eff[$i]['type1'] == 18 || $eff[$i]['type1'] == 19) {
+ $ei .= ' (Травма)';
+ } elseif ($eff[$i]['type1'] == 20) {
+ $ei .= ' (Пристрастие)';
+ } elseif ($eff[$i]['type1'] == 22) {
+ $ei .= ' (Ожидание)';
+ } else {
+ $ei .= ' (Эффект)';
+ }
+ $ei .= '
';
+
+ $out = '';
+ $time_still = ($eff[$i]['timeUse'] + ($eff[$i]['timeAce'] - $eff[$i]['timeUse']) + $eff[$i]['actionTime']);
+ if ($eff[$i]['timeAce'] == 0) {
+ $time_still += $eff[$i]['timeUse'];
+ }
+ $time_still -= time();
+ if ($eff[$i]['bp'] == 0 && $eff[$i]['timeUse'] != 77) {
+ if ($eff[$i]['type1'] != 13) {
+
+ $ei .= 'Осталось: ' . $u->timeOut($time_still) . '';
+ }
+ } else {
+ if ($eff[$i]['timeUse'] != 77 && $eff[$i]['hod'] < 1) {
+ $ei .= 'Осталось: ' . $u->timeOut($time_still) . '';
+ //$ei .= 'Зарядов: '.$out.'
';
+ } elseif ($eff[$i]['hod'] >= 0) {
+ $ei .= 'Зарядов: ' . $eff[$i]['hod'] . '';
+ }
+ }
+
+ if ($eff[$i]['user_use'] != '') {
+ if ($this->users[$this->uids[$eff[$i]['user_use']]]['login2'] != '') {
+ $ei .= '
Автор: ' . $this->users[$this->uids[$eff[$i]['user_use']]]['login2'] . '';
+ } elseif ($this->users[$this->uids[$eff[$i]['user_use']]]['login'] != '') {
+ $ei .= '
Автор: ' . $this->users[$this->uids[$eff[$i]['user_use']]]['login'] . '';
+ }
+ }
+
+ //Действие эффекта
+ $tr = '';
+ $ti = $u->items['add'];
+ $x = 0;
+ $ed = $u->lookStats($eff[$i]['data']);
+ while ($x < count($ti)) {
+ $n = $ti[$x];
+ if (isset($ed['add_' . $n], $u->is[$n]) && $n != 'pog') {
+ $z = '';
+ if ($ed['add_' . $n] > 0) {
+ $z = '+';
+ }
+ $tr .= '
' . $u->is[$n] . ': ' . $z . '' . $ed['add_' . $n];
+ }
+ $x++;
+ }
+
+ if ($ed['add_mib1'] != 0) {
+ if ($ed['add_mab1'] != 0) {
+ $tr .= '
Броня головы: ' . $ed['add_mib1'] . '-' . $ed['add_mab1'] . '';
+ } else {
+ $m1l = $ed['add_mib1'];
+ if ($m1l > 0) {
+ $m1l = '+' . $m1l;
+ }
+ $tr .= '
Броня головы: ' . $m1l . '';
+ }
+ }
+ if ($ed['add_mib2'] != 0) {
+ if ($ed['add_mab2'] != 0) {
+ $tr .= '
Броня корпуса: ' . $ed['add_mib2'] . '-' . $ed['add_mab2'] . '';
+ } else {
+ $m1l = $ed['add_mib2'];
+ if ($m1l > 0) {
+ $m1l = '+' . $m1l;
+ }
+ $tr .= '
Броня корпуса: ' . $m1l . '';
+ }
+ }
+ if ($ed['add_mib3'] != 0) {
+ if ($ed['add_mab3'] != 0) {
+ $tr .= '
Броня пояса: ' . $ed['add_mib3'] . '-' . $ed['add_mab3'] . '';
+ } else {
+ $m1l = $ed['add_mib3'];
+ if ($m1l > 0) {
+ $m1l = '+' . $m1l;
+ }
+ $tr .= '
Броня пояса: ' . $m1l . '';
+ }
+ }
+ if ($ed['add_mib4'] != 0) {
+ if ($ed['add_mab4'] != 0) {
+ $tr .= '
Броня ног: ' . $ed['add_mib4'] . '-' . $ed['add_mab4'] . '';
+ } else {
+ $m1l = $ed['add_mib4'];
+ if ($m1l > 0) {
+ $m1l = '+' . $m1l;
+ }
+ $tr .= '
Броня ног: ' . $m1l . '';
+ }
+ }
+
+ $efix = 0;
+ if (isset($ed['add_pog2']) && $ed['add_pog2'] > 0) {
+ $efix = $ed['add_pog2'];
+ }
+ if (isset($ed['add_pog'])) {
+ $tr .= '
Магический барьер способен поглотить еще ' . $ed['add_pog'] . ' ед. урона';
+ }
+ if (isset($ed['add_pog2'])) {
+ $tr .= '
Магический барьер способен поглотить еще ' . $ed['add_pog2'] . ' ед. урона (' . $ed['add_pog2p'] . '%)';
+ }
+
+ if ($tr != '') {
+ $ei .= $tr;
+ }
+ if ($eff[$i]['info'] != '') {
+ $ei .= '
Информация:
' . $eff[$i]['info'];
+ }
+
+ $ef .= '';
+ unset($efix);
+ }
+ } elseif ($eff[$i] != 'delete') {
+ $i = -2;
+ }
+ $i++;
+ }
+ } else {
+ $ef .= 'Развернуть\',event,3,1,1,1,\'\');\" onmouseout=\"top.hic();\" onmousedown=\"top.hic();\">
';
+ }
+ $ca = '';
+ if ($ur['clan'] > 0) {
+ $cl = Db::getRow('select * from clan where id = ?', [$ur['clan']]);
+ if (isset($cl['id'])) {
+ $ca = '';
+ }
+ }
+ if ($ur['align'] > 0) {
+ $ca = '' . $ca;
+ }
+ if ($ur['login2'] == '') {
+ $ur['login2'] = $ur['login'];
+ }
+ if (floor($st['hpNow']) > $st['hpAll']) {
+ $st['hpNow'] = $st['hpAll'];
+ }
+ if (floor($st['mpNow']) > $st['mpAll']) {
+ $st['mpNow'] = $st['mpAll'];
+ }
+ $stsua = '' . $ur['login2'] . '';
+ $stsua .= '
Сила: ' . $st['s1'];
+ $stsua .= '
Ловкость: ' . $st['s2'];
+ $stsua .= '
Интуиция: ' . $st['s3'];
+ $stsua .= '
Выносливость: ' . $st['s4'];
+ if ($st['s5'] != 0) {
+ $stsua .= '
Интелект: ' . $st['s5'];
+ }
+ if ($st['s6'] != 0) {
+ $stsua .= '
Мудрость: ' . $st['s6'];
+ }
+ if ($st['s7'] != 0) {
+ $stsua .= '
Духовность: ' . $st['s7'];
+ }
+ if ($u->info['admin'] > 0) {
+ $align = $ur['align'];
+ }
+ $tp_img = [
+ 1 => 4,
+ 2 => 5,
+ 14 => 6,
+ 3 => 7,
+ 5 => 8,
+ 7 => 9,
+ 17 => 10,
+ 16 => 11,
+ 13 => 12,
+ 10 => 13,
+ 9 => 14,
+ 8 => 15,
+ 11 => 17, //кольцо 2
+ 12 => 18, //кольцо 3
+ ];
+ $info = 'info_reflesh(' . $t . ',' . $ur['id'] . ',"' . $ca . '' . $ur['login2'] . ' [' . $ur['level'] . '] ","' . $ur['obraz'] . '",' . floor(
+ $st['hpNow']
+ ) . ',' . floor($st['hpAll']) . ',' . floor(
+ $st['mpNow']
+ ) . ',' . floor(
+ $st['mpAll']
+ ) . ',0,' . $ur['sex'] . ',"' . $ef . '","' . $stsua . '", "' . $align . '", "' . $ur['zag'] . '");shpb();';
+ $i = 0;
+ if (is_array($itm)) {
+ while ($i < count($itm)) {
+ //
+ if (isset($st['items_img'][$tp_img[$itm[$i]['inOdet']]])) {
+ $itm[$i]['img'] = $st['items_img'][$tp_img[$itm[$i]['inOdet']]];
+ }
+ //генерируем предметы
+ $ttl = '' . $itm[$i]['name'] . '';
+ $td = $u->lookStats($itm[$i]['data']);
+ $lvar = '';
+ if ($td['add_hpAll'] > 0) {
+ $td['add_hpAll'] = '+' . $td['add_hpAll'];
+ $lvar .= '
Уровень жизни: ' . $td['add_hpAll'] . '';
+ }
+ if ($td['sv_yron_max'] > 0 || $td['sv_yron_min'] > 0) {
+ $lvar .= '
Урон: ' . (0 + $td['sv_yron_min']) . '-' . (0 + $td['sv_yron_max']) . '';
+ }
+ if ($td['add_mab1'] > 0) {
+ if ($td['add_mib1'] == $td['add_mab1'] && $pl['geniration'] == 1) {
+ $m1l = '+';
+ $lvar .= '
Броня головы: ' . $m1l . '' . (0 + $td['add_mab1']) . '';
+ } else {
+ $lvar .= '
Броня головы: ' . (0 + $td['add_mib1']) . '-' . (0 + $td['add_mab1']) . '';
+ }
+ }
+ if ($td['add_mab2'] > 0) {
+ if ($td['add_mib2'] == $td['add_mab2'] && $pl['geniration'] == 1) {
+ $m1l = '+';
+ $lvar .= '
Броня корпуса: ' . $m1l . '' . (0 + $td['add_mab2']) . '';
+ } else {
+ $lvar .= '
Броня корпуса: ' . (0 + $td['add_mib2']) . '-' . (0 + $td['add_mab2']) . '';
+ }
+ }
+ if ($td['add_mab3'] > 0) {
+ if ($td['add_mib3'] == $td['add_mab3'] && $pl['geniration'] == 1) {
+ $m1l = '+';
+ $lvar .= '
Броня пояса: ' . $m1l . '' . (0 + $td['add_mab3']) . '';
+ } else {
+ $lvar .= '
Броня пояса: ' . (0 + $td['add_mib3']) . '-' . (0 + $td['add_mab3']) . '';
+ }
+ }
+ if ($td['add_mab4'] > 0) {
+ if ($td['add_mib4'] == $td['add_mab4'] && $pl['geniration'] == 1) {
+ $m1l = '+';
+ $lvar .= '
Броня ног: ' . $m1l . '' . (0 + $td['add_mab4']) . '';
+ } else {
+ $lvar .= '
Броня ног: ' . (0 + $td['add_mib4']) . '-' . (0 + $td['add_mab4']) . '';
+ }
+ }
+ if ($itm[$i]['iznosMAX'] > 0) {
+ if ($itm[$i]['iznosMAXi'] == 999999999) {
+ $lvar .= '
Долговечность: неразрушимо';
+ } else {
+ $lvar .= '
Долговечность: ' . floor(
+ $itm[$i]['iznosNOW']
+ ) . '/' . floor(
+ $itm[$i]['iznosMAX']
+ );
+ }
+ }
+ $ttl .= $lvar;
+ $ccv = '';
+
+ if ($itm[$i]['magic_inci'] != '' || $itm[$i]['magic_inc'] != '') {
+ if ($itm[$i]['magic_inc'] == '') {
+ $itm[$i]['magic_inc'] = $itm[$i]['magic_inci'];
+ }
+ $mgi = Db::getRow('select * from eff_main where id2 = ? and type1 = 12345', [$itm[$i]['magic_inc']]);
+ if (isset($mgi['id2'])) {
+ $mgilog = '';
+ $ccv .= 'top.useMagicBattle(\'' . $mgi['mname'] . '\',' . $itm[$i]['id'] . ',\'' . $mgi['img'] . '\',1,2);';
+ }
+ }
+
+ $info .= 'abitms(' . (0 + $t) . ',' . (0 + $itm[$i]['uid']) . ',' . (0 + $itm[$i]['id']) . ',' . (0 + $itm[$i]['inOdet']) . ',"' . $itm[$i]['name'] . '","' . $ttl . '","' . $itm[$i]['img'] . '","' . $ccv . '");';
+ $i++;
+ }
+ }
+ return $info;
}
- //Проверка на выживших
+ /**
+ * Проверка на выживших.
+ * Проклято и сломано.
+ * @return bool
+ */
public function testUsersLive(): bool
{
$r = false;
@@ -1176,17 +1121,18 @@ class Battle
return $r;
}
+ // todo stopped here //
+
//Мини лог
- public function miniLogAdd($user, $text)
+ private function miniLogAdd($user, $text)
{
- $txt = $text;
$vLog = 'at1=00000||at2=00000||zb1=0||zb2=0||bl1=0||bl2=0||time1=' . time() . '||time2=' . time(
) . '||s1=' . $user['sex'] . '||t1=' . $user['team'] . '||login1=' . $user['login'] . '||';
$mas1 = [
'time' => time(),
'battle' => $this->info['id'],
'id_hod' => ($this->hodID + 1),
- 'text' => '',
+ 'text' => $text,
'vars' => $vLog,
'zona1' => '',
'zonb1' => '',
@@ -1194,7 +1140,6 @@ class Battle
'zonb2' => '',
'type' => '1',
];
- $mas1['text'] = $txt;
$this->add_log($mas1);
}
@@ -1888,7 +1833,7 @@ class Battle
'INSERT INTO `battle_logs` (`time`,`battle`,`id_hod`,`text`,`vars`,`zona1`,`zonb1`,`zona2`,`zonb2`,`type`) VALUES ("' . $mass['time'] . '","' . $mass['battle'] . '","' . $mass['id_hod'] . '","' . $vtvl . '","' . $mass['vars'] . '","' . $mass['zona1'] . '","' . $mass['zonb1'] . '","' . $mass['zona2'] . '","' . $mass['zonb2'] . '","' . $mass['type'] . '")'
);
- $this->saveLogs($this->info['id'], 'all');
+ $this->saveLogs();
if ($this->info['type'] == 99) {
$vLog = 'time1=' . time();
@@ -2504,7 +2449,9 @@ class Battle
);
$itmnm = $itmnm['name'];
- $cmsg->setText('У ' . $tbot2['login'] . ' был предмет "' . $itmnm . '" и кто угодно может поднять его');
+ $cmsg->setText(
+ 'У ' . $tbot2['login'] . ' был предмет "' . $itmnm . '" и кто угодно может поднять его'
+ );
$chat->sendMsg($cmsg);
$ins = mysql_query(
@@ -3035,16 +2982,16 @@ class Battle
//--------------Лимит 8-9--------------
if ($this->users[$i]['level'] == 8 && $this->users[$i]['battle_exp'] >= 23000) {
$this->users[$i]['battle_exp'] = 23000;
- };
+ }
if ($this->users[$i]['level'] == 9 && $this->users[$i]['battle_exp'] >= 31000) {
$this->users[$i]['battle_exp'] = 31000;
- };
+ }
if ($this->users[$i]['level'] == 10 && $this->users[$i]['battle_exp'] >= 52000) {
$this->users[$i]['battle_exp'] = 52000;
- };
+ }
if ($this->users[$i]['level'] >= 11 && $this->users[$i]['battle_exp'] >= 75000) {
$this->users[$i]['battle_exp'] = 75000;
- };
+ }
//-------------------------------------
if ($this->info['type'] != 33) {
@@ -3742,7 +3689,7 @@ class Battle
'UPDATE `stats` SET `battle_text` = "",`last_b`="0" WHERE `id` = "' . $this->users[$i]['id'] . '" LIMIT 1'
);
mysql_query('UPDATE `battle_users` SET `finish` = 1 WHERE `uid` = "' . $this->users[$i]['id'] . '"');
- $this->saveLogs($this->info['id'], 'all');
+ $this->saveLogs();
if ($u->info['battle'] != 0 && !isset($u->info['battle_lsto'])) {
echo '';
}
@@ -7169,10 +7116,7 @@ class Battle
if ($yron > 0) {
$this->users[$this->uids[$u1]]['battle_yron'] += $yron;
$this->users[$this->uids[$u1]]['battle_exp'] += round(
- 1 * $this->testExp(
- $yron,
- $this->stats[$this->uids[$u1]], $this->stats[$this->uids[$u2]], $u1, $u2
- )
+ $this->testExp($yron, $this->stats[$this->uids[$u2]])
);
if ($this->stats[$this->uids[$u2]]['this_animal'] == 0) {
$this->users[$this->uids[$u1]]['tactic6'] += $adt6;
@@ -7192,10 +7136,7 @@ class Battle
`tactic6` = `tactic6` + "' . $adt6 . '",
`battle_yron` = `battle_yron` + "' . $yron . '",
`battle_exp` = `battle_exp` + "' . round(
- $this->testExp(
- $yron, $this->stats[$this->uids[$u1]],
- $this->stats[$this->uids[$u2]], $u1, $u2
- )
+ $this->testExp($yron, $this->stats[$this->uids[$u2]])
) . '"
WHERE `id` = "' . $u1 . '" LIMIT 1'
);
diff --git a/_incl_data/class/FightRequest.php b/_incl_data/class/FightRequest.php
index e1c04b78..f7f0a891 100644
--- a/_incl_data/class/FightRequest.php
+++ b/_incl_data/class/FightRequest.php
@@ -2042,12 +2042,12 @@ function MM_jumpMenu(targ,selObj,restore){ //v3.0
Комментарий к бою
- if ($this->u->info['level'] < 9) {
+ u->info['level'] < 9) {
?> для 8 левелов недоступны
- } else { ?>
+
- } ?>
+
@@ -2175,18 +2175,18 @@ function MM_jumpMenu(targ,selObj,restore){ //v3.0
|
- if ($html == '') {
+ К сожалению сейчас боев нет...';
} else {
echo '' . $html . '
';
} ?>
diff --git a/_incl_data/class/dnaction/_dungeon_replace.php b/_incl_data/class/dnaction/_dungeon_replace.php
index 39dc3452..f83d1964 100644
--- a/_incl_data/class/dnaction/_dungeon_replace.php
+++ b/_incl_data/class/dnaction/_dungeon_replace.php
@@ -345,10 +345,10 @@ function OpenDiv(vr) {