WIP: Info class

This commit is contained in:
2024-01-06 17:30:34 +02:00
parent a2c658166d
commit 4a7535d67d
44 changed files with 1713 additions and 919 deletions
+159 -161
View File
@@ -31,30 +31,30 @@ class Finish
$this->battle = $battle;
}
public function finishBattle(?array $t, ?array $v, ?int $nl): void
public function finishBattle(?array $t = null, ?array $v = null, ?int $nl = null): void
{
global $u;
$injuryName = [1 => 'легкую', 2 => 'среднюю', 3 => 'тяжелую', 4 => 'неизлечимую',];
$dnr = 0; //???
$chat = new Chat();
$test = Db::getRow('select id, team_win, testfinish from battle where id = ? and team_win != -1', [$this->battle->info['id']]);
$test = Db::getRow('select id, team_win, testfinish from battle where id = ? and team_win != -1', [$this->battle->i->id]);
if ($test['testfinish'] == -1) {
sleep(2);
} else {
Db::sql('update battle set testfinish = -1 where id = ?', [$this->battle->info['id']]);
if ($nl != 10 && $this->battle->info['team_win'] == -1) {
$this->battle->info['team_win'] = 0;
Db::sql('update battle set testfinish = -1 where id = ?', [$this->battle->i->id]);
if ($nl != 10 && $this->battle->i->getTeamwin() == -1) {
$this->battle->i->setTeamWin();
if (is_array($v) && is_array($t)) {
foreach ($v as $vs) {
if ($vs < 1 || $t[$vs] <= 0) {
continue;
}
$this->battle->info['team_win'] = $vs;
$this->battle->i->setTeamWin($vs);
}
}
}
//данные о игроках в бою
$t = Db::getRows(
@@ -71,7 +71,7 @@ class Finish
if(login2 = '',login,login2) as login2
from users
left join stats on users.id = stats.id
where battle = ?", [$this->battle->info['id']]
where battle = ?", [$this->battle->i->id]
);
foreach ($t as $userInBattle) {
@@ -86,13 +86,13 @@ class Finish
$this->battle->stats[key($this->battle->users)] = $u->getStats(uid: $userInBattle['id'], minimal: true);
}
if ($this->battle->info['time_over'] == 0) {
if ($this->battle->i->timeover == 0) {
$tststrt = Db::getRow('select * from battle where id = ? and time_over = 0', [$this->battle->info['id']]);
$tststrt = Db::getRow('select * from battle where id = ? and time_over = 0', [$this->battle->i->id]);
if (isset($tststrt['id'])) {
if ($this->battle->info['inTurnir'] == 0 || $this->battle->info['type'] == 500) {
Db::sql('update battle set time_over = unix_timestamp(), team_win = ? where id = ?', [$this->battle->info['team_win'], $this->battle->info['id']]);
if ($this->battle->i->inturnir == 0 || $this->battle->i->type == 500) {
Db::sql('update battle set time_over = unix_timestamp(), team_win = ? where id = ?', [$this->battle->i->getTeamwin(), $this->battle->i->id]);
}
//Заносим данные о завершении боя
$queryValues = '';
@@ -104,7 +104,7 @@ class Finish
[
$user['login'],
$user['city'],
$this->battle->info['id'],
$this->battle->i->id,
$user['id'],
$user['team'],
$user['level'],
@@ -119,27 +119,28 @@ class Finish
);
$queryValues .= "('$inner',unix_timestamp()),";
if ($user['team'] == $this->battle->info['team_win'] && $this->battle->info['team_win'] > 0) {
if ($user['team'] == $this->battle->i->getTeamwin() && $this->battle->i->getTeamwin() > 0) {
$vtvl .= '<strong>' . $user['login'] . '</strong>, ';
}
}
$this->battle->info['players_c'] = Db::getValue("select count(id) from users where login not like '%(зверь%' and battle = ?", [$this->battle->info['id']]);
Db::sql('update battle set players_c = ? where id = ?', [$this->battle->info['players_c'], $this->battle->info['id']]);
$this->battle->i->setPlayerC();
Db::sql('update battle set players_c = ? where id = ?', [$this->battle->i->getPlayersC(), $this->battle->i->id]);
if (!empty($vtvl)) {
$vtvl = rtrim($vtvl, ', ');
$vtvl = str_replace('"', '\\\\\"', $vtvl);
$logtext = "Бой закончен, победа за $vtvl.";
} else {
$this->battle->info['players_cc'] = $this->battle->info['players_cc2'] = 0;
$this->battle->i->setDraw();
$logtext = 'Бой закончен, ничья.';
}
$this->battle->hodID++;
Log::add(
[
'battle' => $this->battle->info['id'],
'battle' => $this->battle->i->id,
'id_hod' => $this->battle->hodID,
'text' => $logtext,
'vars' => 'time1=' . time(),
@@ -149,9 +150,9 @@ class Finish
unset($logtext);
$this->saveLogs();
if ($this->battle->info['type'] == 99) {
if ($this->battle->i->type == 99) {
$logarray = [
'battle' => $this->battle->info['id'],
'battle' => $this->battle->i->id,
'id_hod' => $this->battle->hodID,
'text' => 'И победители стали калечить проигравших...',
'vars' => 'time1=' . time(),
@@ -161,7 +162,7 @@ class Finish
$vtvl = '';
foreach ($this->battle->users as $userToInjure) {
if ($userToInjure['team'] == $this->battle->info['team_win']) {
if ($userToInjure['team'] == $this->battle->i->getTeamwin()) {
continue;
}
$injuryCaster = Db::getRow('select id, v1 from eff_users where id_eff = 4 and uid = ? order by v1 desc limit 1');
@@ -169,13 +170,13 @@ class Finish
continue;
}
$a = $userToInjure['sex'] == 1 ? 'а' : '';
$injuryType = $this->battle->info['smert'] == 1 ? 4 : mt_rand(1, 3);
$injuryType = $this->battle->i->smert == 1 ? 4 : mt_rand(1, 3);
if (!empty($injuryCaster['id'])) {
$injuryType = mt_rand($injuryCaster['v1'] + 1, 3);
}
$vtvl = "<strong>{$userToInjure['login']}</strong> получил$a повреждение:" .
" <span style='color: crimson;'>$injuryName[$injuryType]</span>.<br>$vtvl";
$this->battle->addTravm($userToInjure['id'], $injuryType, rand(3, 5));
Effects::addInjury($userToInjure['id'], $injuryType, rand(3, 5));
}
$logarray['text'] = $vtvl;
@@ -188,12 +189,12 @@ class Finish
}
Db::sql(
'insert into battle_end (battle_id, city, time, team_win) values (?,?,?,?)',
[$this->battle->info['id'], $this->battle->info['city'], $this->battle->info['time_start'], $this->battle->info['team_win']]
[$this->battle->i->id, $this->battle->i->city, $this->battle->i->timeStart, $this->battle->i->getTeamwin()]
);
}
$logarray = [
'battle' => $this->battle->info['id'],
'battle' => $this->battle->i->id,
'id_hod' => $this->battle->hodID,
'vars' => 'time1=' . time(),
'type' => '1',
@@ -201,7 +202,7 @@ class Finish
$vtvl = '';
foreach ($this->battle->users as $userToInjure) {
if ($userToInjure['team'] == $this->battle->info['team_win'] || $this->battle->info['team_win'] == 0) {
if ($userToInjure['team'] == $this->battle->i->getTeamwin() || $this->battle->i->getTeamwin() == 0) {
continue;
}
$injuryCaster = Db::getRow("select id, v1, data, user_use from eff_users where v1 = 'priem' and v2 = 292 and uid = ? limit 1");
@@ -217,11 +218,11 @@ class Finish
$vtvl = "<strong>{$userToInjure['login']}</strong> получил$a повреждение" .
" (Искалечить, автор: <strong>$injuryCasterLogin</strong>):" .
" <span style='color: crimson;'>$injuryName[$injuryType]</span>.<br>$vtvl";
$this->battle->addTravm($userToInjure['id'], $injuryType, rand(3, 5));
Effects::addInjury($userToInjure['id'], $injuryType, rand(3, 5));
}
if (!empty($vtvl)) {
if ($this->battle->info['type'] != 99) {
if ($this->battle->i->type != 99) {
$logarray['text'] = 'И победители стали калечить проигравших...';
Log::add($logarray);
}
@@ -231,9 +232,9 @@ class Finish
//Турнир БС
if ($this->battle->info['inTurnir'] > 0 && $this->battle->info['dungeon'] != 15 && $u->info['room'] != 413) {
if ($this->battle->i->inturnir > 0 && $this->battle->i->dungeon != 15 && $u->info['room'] != 413) {
$bs = mysql_fetch_array(
mysql_query('SELECT * FROM `bs_turnirs` WHERE `id` = "' . $this->battle->info['inTurnir'] . '" LIMIT 1')
mysql_query('SELECT * FROM `bs_turnirs` WHERE `id` = "' . $this->battle->i->inturnir . '" LIMIT 1')
);
$i = 0;
$j = 0;
@@ -320,7 +321,7 @@ class Finish
}
//Награда за события
if ($this->battle->info['type'] == 500 && isset($tststrt['id'])) {
if ($this->battle->i->type == 500 && isset($tststrt['id'])) {
//Предметы которые выпадают в центр
$i = 0;
@@ -335,7 +336,7 @@ class Finish
)
);
if (isset($mon['id'])) {
if ($this->battle->info['team_win'] == 0) {
if ($this->battle->i->getTeamwin() == 0) {
//Ничья
mysql_query(
'UPDATE `stats` SET `hpNow` = "' . $this->battle->stats[$i]['hpAll'] . '",`mpNow` = "' . $this->battle->stats[$i]['mpAll'] . '" WHERE `id` = "' . $this->battle->users[$i]['id'] . '" LIMIT 1'
@@ -348,7 +349,7 @@ class Finish
)
);
$chat->sendMsg($cmsg);
} elseif ($this->battle->info['team_win'] != $this->battle->users[$i]['team']) {
} elseif ($this->battle->i->getTeamwin() != $this->battle->users[$i]['team']) {
//Выиграли
$j = 0;
$usrwin = '';
@@ -421,7 +422,7 @@ class Finish
if (isset($tststrt['id'])) {
while ($i < count($this->battle->users)) {
//Тут выкидываем юзеров из Призавого хаота
if ($this->battle->info['type'] == 33) {
if ($this->battle->i->type == 33) {
$plde = mysql_fetch_array(
mysql_query('SELECT * FROM `users` WHERE `id` = "' . $this->battle->users[$i]['id'] . '" LIMIT 1')
);
@@ -438,7 +439,7 @@ class Finish
'UPDATE `users_achiv` SET `pg`= `pg`+1 WHERE `id` = "' . $pld['id'] . '" LIMIT 1'
);
if ($this->battle->users[$i]['team'] == $this->battle->info['team_win'] && rand(1, 100) <= 5) {
if ($this->battle->users[$i]['team'] == $this->battle->i->getTeamwin() && rand(1, 100) <= 5) {
ItemsModel::addItem(10020, $pld['id'], '');
$pld['battle_text'] .= ' За Героическое Сражение вы получаете <strong>Жетон Успеха</strong>. ';
}
@@ -494,9 +495,9 @@ class Finish
}
if ($this->battle->users[$i]['clone'] > 0 && $this->battle->users[$i]['bot'] > 0 && isset($this->battle->users[$this->battle->uids[$this->battle->users[$i]['clone']]]['id']) && $this->battle->users[$this->battle->uids[$this->battle->users[$i]['clone']]]['team'] != $this->battle->users[$i]['team']) {
//Добавляем что клон побежден
if ($this->battle->users[$this->battle->uids[$this->battle->users[$i]['clone']]]['team'] == $this->battle->info['team_win']) {
if ($this->battle->users[$this->battle->uids[$this->battle->users[$i]['clone']]]['team'] == $this->battle->i->getTeamwin()) {
$u->addAction(time(), 'win_bot_clone', '', $this->battle->users[$i]['clone']);
} elseif ($this->battle->info['team_win'] == 0) {
} elseif ($this->battle->i->getTeamwin() == 0) {
$u->addAction(time(), 'nich_bot_clone', '', $this->battle->users[$i]['clone']);
} else {
$u->addAction(time(), 'lose_bot_clone', '', $this->battle->users[$i]['clone']);
@@ -506,7 +507,7 @@ class Finish
$j = 0;
while ($j < count($this->battle->users)) {
if ($this->battle->users[$j]['bot'] == 0 && $this->battle->users[$j]['team'] != $this->battle->users[$i]['team']) {
if ($this->battle->users[$j]['team'] == $this->battle->info['team_win']) { // if($this->battle->users[$j]['team']==$this->battle->info['team_win']){
if ($this->battle->users[$j]['team'] == $this->battle->i->getTeamwin()) { // if($this->battle->users[$j]['team']==$this->battle->i->getTeamwin()){
$u->addAction(
time(), 'win_bot_' . $this->battle->users[$i]['bot_id'], '',
$this->battle->users[$j]['id']
@@ -519,7 +520,7 @@ class Finish
LIMIT 1'
);
//
} elseif ($this->battle->info['team_win'] == 0) {
} elseif ($this->battle->i->getTeamwin() == 0) {
$u->addAction(
time(), 'nich_bot_' . $this->battle->users[$i]['bot_id'], '',
$this->battle->users[$j]['id']
@@ -539,11 +540,11 @@ class Finish
}
//Из бота падают предметы
if ($nl != 10 && $this->battle->info['dungeon'] > 0) {
if ($this->battle->info['team_win'] == $u->info['team'] && $this->battle->info['dungeon'] == 102) {
if ($nl != 10 && $this->battle->i->dungeon > 0) {
if ($this->battle->i->getTeamwin() == $u->info['team'] && $this->battle->i->dungeon == 102) {
$j1 = mysql_fetch_array(
mysql_query(
'SELECT * FROM `laba_obj` WHERE `type` = 2 AND `lib` = "' . $this->battle->info['dn_id'] . '" AND `x` = "' . $this->battle->info['x'] . '" AND `y` = "' . $this->battle->info['y'] . '" LIMIT 1'
'SELECT * FROM `laba_obj` WHERE `type` = 2 AND `lib` = "' . $this->battle->i->dnId . '" AND `x` = "' . $this->battle->i->x . '" AND `y` = "' . $this->battle->i->y . '" LIMIT 1'
)
);
if (isset($j1['id'])) {
@@ -555,14 +556,14 @@ class Finish
)'
);
}
} elseif ($this->battle->info['team_win'] == $u->info['team']) {
} elseif ($this->battle->i->getTeamwin() == $u->info['team']) {
//выйграли люди, выкидываем предметы из мобов
$j1 = mysql_query(
'SELECT * FROM `dungeon_bots` WHERE `dn` = "' . $this->battle->info['dn_id'] . '" AND `for_dn` = "0" AND `x` = "' . $this->battle->info['x'] . '" AND `delete` = "0" AND `y`= "' . $this->battle->info['y'] . '" LIMIT 100'
'SELECT * FROM `dungeon_bots` WHERE `dn` = "' . $this->battle->i->dnId . '" AND `for_dn` = "0" AND `x` = "' . $this->battle->i->x . '" AND `delete` = "0" AND `y`= "' . $this->battle->i->y . '" LIMIT 100'
);
while ($tbot = mysql_fetch_array($j1)) {
$cmsg = new ChatMessage();
$cmsg->setDn($this->battle->info['dn_id']);
$cmsg->setDn($this->battle->i->dnId);
$cmsg->setRoom($this->battle->users[0]['room']);
$cmsg->setType(6);
$cmsg->setTypeTime(1);
@@ -606,12 +607,12 @@ class Finish
mysql_query(
'INSERT INTO `dungeon_items` (`dn`,`user`,`item_id`,`time`,`x`,`y`) VALUES (
"' . $this->battle->info['dn_id'] . '",
"' . $this->battle->i->dnId . '",
"' . $tou . '",
"' . $itmz[0] . '",
"' . time() . '",
"' . $this->battle->info['x'] . '",
"' . $this->battle->info['y'] . '")'
"' . $this->battle->i->x . '",
"' . $this->battle->i->y . '")'
);
if (!isset($questDrop['id'])) {
$testdrop = 1; //ТУТ drop-drop //quest
@@ -629,7 +630,7 @@ class Finish
date('m') == 9 &&
date('d') < 15 &&
!Helper::getChanse(99) &&
($this->battle->info['dungeon'] == 12 || $this->battle->info['dungeon'] == 101)
($this->battle->i->dungeon == 12 || $this->battle->i->dungeon == 101)
) {
$tou = 0; //какому юзеру предназначено
/* выделяем случайного юзера из команды */
@@ -645,12 +646,12 @@ class Finish
mysql_query(
'INSERT INTO `dungeon_items` (`dn`,`user`,`item_id`,`time`,`x`,`y`) VALUES (
"' . $this->battle->info['dn_id'] . '",
"' . $this->battle->i->dnId . '",
"' . $tou . '",
"' . $itmz[0] . '",
"' . time() . '",
"' . $this->battle->info['x'] . '",
"' . $this->battle->info['y'] . '")'
"' . $this->battle->i->x . '",
"' . $this->battle->i->y . '")'
);
}
//
@@ -661,10 +662,10 @@ class Finish
}
if (
$this->battle->info['dungeon'] == 12 || $this->battle->info['dungeon'] == 3 ||
$this->battle->info['dungeon'] == 101 || $this->battle->info['dungeon'] == 16 ||
$this->battle->info['dungeon'] == 9 || $this->battle->info['dungeon'] == 10 ||
$this->battle->info['dungeon'] == 13 || $this->battle->info['dungeon'] == 106
$this->battle->i->dungeon == 12 || $this->battle->i->dungeon == 3 ||
$this->battle->i->dungeon == 101 || $this->battle->i->dungeon == 16 ||
$this->battle->i->dungeon == 9 || $this->battle->i->dungeon == 10 ||
$this->battle->i->dungeon == 13 || $this->battle->i->dungeon == 106
) {
$tou = 0; //какому юзеру предназначено
// выделяем случайного юзера из команды
@@ -676,25 +677,25 @@ class Finish
mysql_query(
'INSERT INTO `dungeon_items` (`dn`,`user`,`item_id`,`time`,`x`,`y`) VALUES (
"' . $this->battle->info['dn_id'] . '",
"' . $this->battle->i->dnId . '",
"' . $tou . '",
"' . $itmz . '",
"' . time() . '",
"' . $this->battle->info['x'] . '",
"' . $this->battle->info['y'] . '")'
"' . $this->battle->i->x . '",
"' . $this->battle->i->y . '")'
);
}
}
mysql_query(
'UPDATE `dungeon_bots` SET `delete` = "' . time(
) . '" AND `inBattle` = "' . $this->battle->info['id'] . '" WHERE `dn` = "' . $this->battle->info['dn_id'] . '" AND `for_dn` = "0" AND `delete` = "0" '
) . '" AND `inBattle` = "' . $this->battle->i->id . '" WHERE `dn` = "' . $this->battle->i->dnId . '" AND `for_dn` = "0" AND `delete` = "0" '
);
} else {
//выкидываем всех игроков в клетку RESTART
$dnr = 1;
if ($this->battle->info['dungeon'] != 102) {
if ($this->battle->i->dungeon != 102) {
mysql_query(
'UPDATE `dungeon_bots` SET `inBattle` = "0" WHERE `dn` = "' . $this->battle->info['dn_id'] . '" AND `for_dn` = "0" AND `x` = "' . $this->battle->info['x'] . '" AND `y`= "' . $this->battle->info['y'] . '"'
'UPDATE `dungeon_bots` SET `inBattle` = "0" WHERE `dn` = "' . $this->battle->i->dnId . '" AND `for_dn` = "0" AND `x` = "' . $this->battle->i->x . '" AND `y`= "' . $this->battle->i->y . '"'
);
}
}
@@ -711,7 +712,7 @@ class Finish
//завершаем поединок
$i = $this->battle->uids[$u->info['id']];
if ($this->battle->info['team_win'] >= 0) {
if ($this->battle->i->getTeamwin() >= 0) {
$cmsg = new ChatMessage();
$cmsg->setRoom($this->battle->users[$i]['room']);
$cmsg->setType(6);
@@ -721,7 +722,7 @@ class Finish
$this->expCoef += $this->battle->stats[$i]['pbe'];
}
if ($this->battle->info['razdel'] == 5 && (Config::get('m') >= 6 && Config::get('m') <= 8 || Config::get('w') == 0 || Config::get('w') == 6)) {
if ($this->battle->i->razdel == 5 && (Config::get('m') >= 6 && Config::get('m') <= 8 || Config::get('w') == 0 || Config::get('w') == 6)) {
$this->expCoef += 5;
}
@@ -736,17 +737,17 @@ class Finish
$act01 = 0;
$this->battle->users[$i]['battle_exp'] = round(
$this->battle->users[$i]['battle_exp'] + ($this->battle->users[$i]['battle_exp'] / 100 * (1 + $this->battle->info['addExp'] + $this->battle->stats[$i]['exp']))
$this->battle->users[$i]['battle_exp'] + ($this->battle->users[$i]['battle_exp'] / 100 * (1 + $this->battle->i->getAddexp() + $this->battle->stats[$i]['exp']))
);
if ($this->battle->info['type'] == 564) {
if ($this->battle->i->type == 564) {
//Бой с копией
$this->battle->users[$i]['battle_exp'] = 0;
}
if ($this->battle->info['dungeon'] == 104) {
if ($this->battle->i->dungeon == 104) {
$this->battle->users[$i]['battle_exp'] = ($u->info['level'] * 2) * (count($this->battle->uids) - 1);
} elseif ($this->battle->info['dungeon'] > 0 && $this->battle->users[$i]['dnow'] != 0 && $this->battle->info['dungeon'] != 1 && $this->battle->users[$i]['team'] == $this->battle->info['team_win']) {
} elseif ($this->battle->i->dungeon > 0 && $this->battle->users[$i]['dnow'] != 0 && $this->battle->i->dungeon != 1 && $this->battle->users[$i]['team'] == $this->battle->i->getTeamwin()) {
$dun_limitForLevel = [
4 => 750,
5 => 1500,
@@ -779,32 +780,32 @@ class Finish
unset($rep);
}
if (!isset($dun_exp[$this->battle->info['dungeon']])) {
$dun_exp[$this->battle->info['dungeon']] = 0;
if (!isset($dun_exp[$this->battle->i->dungeon])) {
$dun_exp[$this->battle->i->dungeon] = 0;
}
if (!isset($dun_limitForLevel[(int)$this->battle->users[$i]['level']])) { // Если лимит не задан, опыт не даем.
$this->battle->users[$i]['battle_exp'] = 0;
} elseif (
isset($dun_exp[$this->battle->info['dungeon']]) &&
$dun_exp[$this->battle->info['dungeon']] >= $dun_limitForLevel[(int)$this->battle->users[$i]['level']]
isset($dun_exp[$this->battle->i->dungeon]) &&
$dun_exp[$this->battle->i->dungeon] >= $dun_limitForLevel[(int)$this->battle->users[$i]['level']]
) { // Если лимит уже достигнут, опыт не даем.
$this->battle->users[$i]['battle_exp'] = 0;
} elseif (
isset($dun_exp[$this->battle->info['dungeon']]) &&
$dun_limitForLevel[(int)$this->battle->users[$i]['level']] > $dun_exp[$this->battle->info['dungeon']]
isset($dun_exp[$this->battle->i->dungeon]) &&
$dun_limitForLevel[(int)$this->battle->users[$i]['level']] > $dun_exp[$this->battle->i->dungeon]
) { // Если текущая репутация не достигла лимита.
if (($dun_exp[$this->battle->info['dungeon']] + $this->battle->users[$i]['battle_exp']) > $dun_limitForLevel[(int)$this->battle->users[$i]['level']]) {
if (($dun_exp[$this->battle->i->dungeon] + $this->battle->users[$i]['battle_exp']) > $dun_limitForLevel[(int)$this->battle->users[$i]['level']]) {
// Если опыта набрано достаточно, для достижения лимита.
$this->battle->users[$i]['battle_exp'] = abs(
$this->battle->users[$i]['battle_exp'] - abs(
$dun_limitForLevel[(int)$this->battle->users[$i]['level']] - ($this->battle->users[$i]['battle_exp'] + $dun_exp[$this->battle->info['dungeon']])
$dun_limitForLevel[(int)$this->battle->users[$i]['level']] - ($this->battle->users[$i]['battle_exp'] + $dun_exp[$this->battle->i->dungeon])
)
);
$dun_exp[$this->battle->info['dungeon']] += $this->battle->users[$i]['battle_exp'];
} elseif ($dun_limitForLevel[(int)$this->battle->users[$i]['level']] > ($dun_exp[$this->battle->info['dungeon']] + $this->battle->users[$i]['battle_exp'])) {
$dun_exp[$this->battle->i->dungeon] += $this->battle->users[$i]['battle_exp'];
} elseif ($dun_limitForLevel[(int)$this->battle->users[$i]['level']] > ($dun_exp[$this->battle->i->dungeon] + $this->battle->users[$i]['battle_exp'])) {
// Если опыта недостаточно, для достижения лимита.
$dun_exp[$this->battle->info['dungeon']] += $this->battle->users[$i]['battle_exp'];
$dun_exp[$this->battle->i->dungeon] += $this->battle->users[$i]['battle_exp'];
} else {
$this->battle->users[$i]['battle_exp'] = 0;
}
@@ -813,7 +814,7 @@ class Finish
}
if ($this->battle->users[$i]['battle_exp'] > 0 && isset($dun_exp[$this->battle->info['dungeon']]) && $dun_exp[$this->battle->info['dungeon']] > 0) {
if ($this->battle->users[$i]['battle_exp'] > 0 && isset($dun_exp[$this->battle->i->dungeon]) && $dun_exp[$this->battle->i->dungeon] > 0) {
$dunexp = [];
foreach ($dun_exp as $key => $val) {
$dunexp[$key] = $key . '=' . $val; // текущий лимит опыта в подземке
@@ -834,31 +835,31 @@ class Finish
);
}
if ($this->battle->info['team_win'] == 0 && $this->battle->info['type'] != 564) {
if ($this->battle->i->getTeamwin() == 0 && $this->battle->i->type != 564) {
if ($this->battle->users[$i]['level'] <= 1) {
$this->battle->users[$i]['battle_exp'] = floor($this->battle->users[$i]['battle_exp'] * 0.50);
} else {
$this->battle->users[$i]['battle_exp'] = ceil($this->battle->users[$i]['battle_exp'] * 0.10);
}
$this->battle->users[$i]['nich'] += 1;
} elseif ($this->battle->users[$i]['team'] == $this->battle->info['team_win'] && $this->battle->info['type'] != 564) {
$gm[$i] = $this->battle->info['money'];
$gms[$i] = $this->battle->info['money3'];
} elseif ($this->battle->users[$i]['team'] == $this->battle->i->getTeamwin() && $this->battle->i->type != 564) {
$gm[$i] = $this->battle->i->money;
$gms[$i] = $this->battle->i->money3;
$this->battle->users[$i]['win'] += 1;
$act01 = 1;
} elseif ($this->battle->info['type'] != 564) {
} elseif ($this->battle->i->type != 564) {
if ($this->battle->users[$i]['level'] <= 1) {
$this->battle->users[$i]['battle_exp'] = ceil($this->battle->users[$i]['battle_exp'] * 0.33);
} else {
$this->battle->users[$i]['battle_exp'] = ceil($this->battle->users[$i]['battle_exp'] * 0.10);
}
$bm[$i] = $this->battle->info['money'];
$bms[$i] = $this->battle->info['money3'];
$bm[$i] = $this->battle->i->money;
$bms[$i] = $this->battle->i->money3;
$this->battle->users[$i]['lose'] += 1;
$act01 = 2;
}
//Рассчитываем кол-во выигрышных сумм и кто сколько получил (для екр.)
if ($this->battle->info['money3'] > 0 && isset($gms[$i]) && $this->battle->info['type'] != 564) {
if ($this->battle->i->money3 > 0 && isset($gms[$i]) && $this->battle->i->type != 564) {
$mn = [
'l' => 0, //сколько проигравших игроков
'w' => 0, //сколько выигрывших игроков
@@ -867,17 +868,17 @@ class Finish
if ($act01 == 1) {
$mn['l'] = mysql_fetch_array(
mysql_query(
'SELECT COUNT(`id`) FROM `battle_users` WHERE `battle` = "' . $this->battle->info['id'] . '" AND `team` != "' . $this->battle->users[$i]['team'] . '" LIMIT 1'
'SELECT COUNT(`id`) FROM `battle_users` WHERE `battle` = "' . $this->battle->i->id . '" AND `team` != "' . $this->battle->users[$i]['team'] . '" LIMIT 1'
)
);
$mn['l'] = $mn['l'][0];
$mn['w'] = mysql_fetch_array(
mysql_query(
'SELECT COUNT(`id`) FROM `battle_users` WHERE `battle` = "' . $this->battle->info['id'] . '" AND `team` = "' . $this->battle->users[$i]['team'] . '" LIMIT 1'
'SELECT COUNT(`id`) FROM `battle_users` WHERE `battle` = "' . $this->battle->i->id . '" AND `team` = "' . $this->battle->users[$i]['team'] . '" LIMIT 1'
)
);
$mn['w'] = $mn['w'][0];
$mn['m'] = round(($mn['l'] * $this->battle->info['money3']) / 100 * 87, 2);
$mn['m'] = round(($mn['l'] * $this->battle->i->money3) / 100 * 87, 2);
$gms[$i] = round(($mn['m'] / $mn['w']), 2);
}
}
@@ -897,7 +898,7 @@ class Finish
$lom = 0.05;
}
$nlom = [0 => rand(0, 18), 1 => rand(0, 18), 2 => rand(0, 18), 3 => rand(0, 18)];
if ($this->battle->info['type'] == 564 || $this->battle->stats[$i]['silver']) {
if ($this->battle->i->type == 564 || $this->battle->stats[$i]['silver']) {
$lom = 0;
}
@@ -911,10 +912,10 @@ class Finish
}
if ($this->battle->users[$i]['animal'] > 0) {
$ulan = $u->testAction(
'`uid` = "' . $this->battle->users[$i]['id'] . '" AND `vars` = "animal_use' . $this->battle->info['id'] . '" LIMIT 1',
'`uid` = "' . $this->battle->users[$i]['id'] . '" AND `vars` = "animal_use' . $this->battle->i->id . '" LIMIT 1',
1
);
if (isset($ulan['id']) && $this->battle->users[$i]['team'] == $this->battle->info['team_win'] && $this->battle->users[$i]['level'] > $ulan['vals']) {
if (isset($ulan['id']) && $this->battle->users[$i]['team'] == $this->battle->i->getTeamwin() && $this->battle->users[$i]['level'] > $ulan['vals']) {
$a004 = mysql_fetch_array(
mysql_query(
'SELECT `max_exp`,`name` FROM `users_animal` WHERE `uid` = "' . $this->battle->users[$i]['id'] . '" AND `id` = "' . $this->battle->users[$i]['animal'] . '" AND `pet_in_cage` = "0" AND `delete` = "0" LIMIT 1'
@@ -936,52 +937,49 @@ class Finish
);
if ($upd) {
$this->battle->users[$i]['battle_exp'] = round($this->battle->users[$i]['battle_exp'] / 100 * 67);
$this->battle->info['addExp'] -= 33.333;
$this->battle->i->modifyAddExp(-33.333);
}
}
}
$prsusers = mysql_fetch_array(
mysql_query(
'SELECT SUM(`price1`) FROM `battle_users` WHERE `battle` = "' . $this->battle->info['id'] . '" LIMIT 1'
'SELECT SUM(`price1`) FROM `battle_users` WHERE `battle` = "' . $this->battle->i->id . '" LIMIT 1'
)
);
$this->btlstatus = Battle::getType($prsusers[0]);
if ($this->battle->info['smert'] == 1) {
if ($this->battle->i->smert == 1) {
$this->btlstatus = [150, 150, 'Жесточайшее Сражение', 'Жесточайшее Сражение'];
}
//
if ($this->battle->stats[$i]['clanpos'] > 0 && ($this->battle->stats[$i]['clanpos'] == 1 || $this->battle->stats[$i]['clanpos'] == 2 || $this->battle->stats[$i]['clanpos'] == 3)) {
$this->battle->info['addExp'] += 0;
}
unset($r1);
//Статусная битва
if ($this->btlstatus[0] > 0) {
if ($this->battle->info['type'] == 99) {
$this->battle->info['addExp'] += $this->btlstatus[1];
if ($this->battle->i->type == 99) {
$this->battle->i->modifyAddExp($this->btlstatus[1]);
} else {
$this->battle->info['addExp'] += $this->btlstatus[0];
$this->battle->i->modifyAddExp($this->btlstatus[0]);
}
}
if ($this->battle->users[$i]['align'] == 2 || $this->battle->users[$i]['haos'] > time()) {
$this->battle->stats[$i]['exp'] = -($this->battle->info['addExp'] + 50);
$this->battle->stats[$i]['exp'] = -($this->battle->i->getAddexp() + 50);
}
if ($this->battle->info['addExp'] + $this->battle->stats[$i]['exp'] != 0) {
$prc = ' (' . (100 + $this->battle->info['addExp'] + $this->battle->stats[$i]['exp']) . '%)';
if ($this->battle->i->getAddexp() + $this->battle->stats[$i]['exp'] != 0) {
$prc = ' (' . (100 + $this->battle->i->getAddexp() + $this->battle->stats[$i]['exp']) . '%)';
}
if ($this->battle->info['money'] > 0) {
if ($this->battle->i->money > 0) {
if (isset($gm[$i])) {
$prc .= ' Вы выйграли <strong>' . $gm[$i] . ' кр.</strong> за этот бой.';
Delo::add(
4,
'System.battle',
$this->battle->users[$i]['id'],
'&quot;<span style="color: olive; ">System.battle</span>&quot;: Персонаж выйграл <strong>' . $gm[$i] . ' кр.</strong> (В бою №' . $this->battle->info['id'] . ').',
'&quot;<span style="color: olive; ">System.battle</span>&quot;: Персонаж выйграл <strong>' . $gm[$i] . ' кр.</strong> (В бою №' . $this->battle->i->id . ').',
);
$this->battle->users[$i]['money'] += $gm[$i];
} elseif (isset($bm[$i])) {
@@ -990,12 +988,12 @@ class Finish
4,
'System.battle',
$this->battle->users[$i]['id'],
'&quot;<span style="color: olive; ">System.battle</span>&quot;: Персонаж <i>проиграл</i> <strong>' . $gm[$i] . ' кр.</strong> (В бою №' . $this->battle->info['id'] . ').',
'&quot;<span style="color: olive; ">System.battle</span>&quot;: Персонаж <i>проиграл</i> <strong>' . $gm[$i] . ' кр.</strong> (В бою №' . $this->battle->i->id . ').',
);
$this->battle->users[$i]['money'] -= $bm[$i];
}
}
if (Config::get('money_haot') && $this->battle->users[$i]['exp'] <= 200000000 && $act01 == 1 && $this->battle->info['razdel'] == 5 && $this->battle->users[$i]['level'] >= 8) {
if (Config::get('money_haot') && $this->battle->users[$i]['exp'] <= 200000000 && $act01 == 1 && $this->battle->i->razdel == 5 && $this->battle->users[$i]['level'] >= 8) {
//Сколько нужно опыта набить
$trexp = [
8 => 1200,
@@ -1047,26 +1045,26 @@ class Finish
if ($this->battle->users[$i]['battle_exp'] < $trexp) {
$prc .= ', Награда <strong>0 ЕКР</strong> за этот бой (Мало опыта набили).';
} elseif ($admn > 0) {
if ($this->battle->info['type'] != 33) {
if ($this->battle->i->type != 33) {
$prc .= ', Награда <strong>' . $admn . ' ЕКР</strong> за этот бой.';
}
Delo::add(
4,
'System.battle',
$this->battle->users[$i]['id'],
'&quot;<span style="color: olive; ">System.battle</span>&quot;: Персонаж получил <strong>' . $admn . ' ЕКР</strong> (В бою №' . $this->battle->info['id'] . ').',
'&quot;<span style="color: olive; ">System.battle</span>&quot;: Персонаж получил <strong>' . $admn . ' ЕКР</strong> (В бою №' . $this->battle->i->id . ').',
);
$this->battle->users[$i]['money2'] += $admn;
}
}
if ($this->battle->info['money3'] > 0) {
if ($this->battle->i->money3 > 0) {
if (isset($gms[$i])) {
$prc .= ' Вы выйграли <strong>' . $gms[$i] . ' $.</strong> за этот бой.';
Delo::add(
4,
'System.battle',
$this->battle->users[$i]['id'],
'&quot;<span style="color: olive; ">System.battle</span>&quot;: Персонаж выйграл <strong>' . $gms[$i] . ' $.</strong> (В бою №' . $this->battle->info['id'] . ').',
'&quot;<span style="color: olive; ">System.battle</span>&quot;: Персонаж выйграл <strong>' . $gms[$i] . ' $.</strong> (В бою №' . $this->battle->i->id . ').',
);
$this->battle->users[$i]['money3'] += $gms[$i];
mysql_query(
@@ -1078,7 +1076,7 @@ class Finish
4,
'System.battle',
$this->battle->users[$i]['id'],
'&quot;<span style="color: olive; ">System.battle</span>&quot;: Персонаж <i>проиграл</i> <strong>' . $gms[$i] . ' $.</strong> (В бою №' . $this->battle->info['id'] . ').',
'&quot;<span style="color: olive; ">System.battle</span>&quot;: Персонаж <i>проиграл</i> <strong>' . $gms[$i] . ' $.</strong> (В бою №' . $this->battle->i->id . ').',
);
$this->battle->users[$i]['money3'] -= $bms[$i];
mysql_query(
@@ -1126,30 +1124,30 @@ class Finish
unset($lime);
if ($this->btlstatus[0] > 0) {
if ($this->battle->info['type'] == 99) {
if ($this->battle->i->type == 99) {
$prc .= ' (' . $this->btlstatus[3] . ')';
} else {
$prc .= ' (' . $this->btlstatus[2] . ')';
}
}
if ($this->battle->info['dungeon'] == 1 && $this->battle->users[$i]['team'] == $this->battle->info['team_win']) {
if ($this->battle->i->dungeon == 1 && $this->battle->users[$i]['team'] == $this->battle->i->getTeamwin()) {
//канализация лимит
$rep = mysql_fetch_array(
mysql_query(
'SELECT `dl1`,`id` FROM `rep` WHERE `id` = "' . $this->battle->users[$i]['id'] . '" LIMIT 1'
)
);
if ($rep['dl' . $this->battle->info['dungeon']] > 0) {
if ($rep['dl' . $this->battle->i->dungeon] > 0) {
$this->battle->users[$i]['battle_exp'] += 3 * count($this->battle->users);
if ($rep['dl' . $this->battle->info['dungeon']] > $this->battle->users[$i]['battle_exp']) {
$rep['dl' . $this->battle->info['dungeon']] -= $this->battle->users[$i]['battle_exp'];
if ($rep['dl' . $this->battle->i->dungeon] > $this->battle->users[$i]['battle_exp']) {
$rep['dl' . $this->battle->i->dungeon] -= $this->battle->users[$i]['battle_exp'];
} else {
$this->battle->users[$i]['battle_exp'] = $rep['dl' . $this->battle->info['dungeon']];
$rep['dl' . $this->battle->info['dungeon']] = 0;
$this->battle->users[$i]['battle_exp'] = $rep['dl' . $this->battle->i->dungeon];
$rep['dl' . $this->battle->i->dungeon] = 0;
}
mysql_query(
'UPDATE `rep` SET `dl' . $this->battle->info['dungeon'] . '` = "' . $rep['dl' . $this->battle->info['dungeon']] . '" WHERE `id` = "' . $rep['id'] . '" LIMIT 1'
'UPDATE `rep` SET `dl' . $this->battle->i->dungeon . '` = "' . $rep['dl' . $this->battle->i->dungeon] . '" WHERE `id` = "' . $rep['id'] . '" LIMIT 1'
);
} else {
$this->battle->users[$i]['battle_exp'] = 0;
@@ -1163,9 +1161,9 @@ class Finish
if (
$this->battle->users[$i]['battle_exp'] < 1 &&
$this->battle->users[$i]['twink'] == 0 &&
$this->battle->info['money'] == 0 &&
$this->battle->info['money3'] == 0 &&
$this->battle->info['kingfight'] == 0 &&
$this->battle->i->money == 0 &&
$this->battle->i->money3 == 0 &&
$this->battle->i->kingfight == 0 &&
(!isset($admnb) || $admnb == 0)
) {
$prc = '';
@@ -1194,14 +1192,14 @@ class Finish
}
//-------------------------------------
if ($this->battle->info['type'] != 33) {
if ($this->battle->i->type != 33) {
$this->battle->users[$i]['battle_text'] = 'Бой закончен. Всего вами нанесено урона: <strong>' . floor(
$this->battle->users[$i]['battle_yron']
) . ' HP</strong>. Получено опыта: <strong>' . (0 + $this->battle->users[$i]['battle_exp']) . '</strong>' . $prc . '.' . $sinf; //stats
}
//Снижение времени Право на подвиг Титул за победу в хаоте
if ($this->battle->info['dungeon'] == 0 && $this->battle->info['razdel'] == 5 && $this->battle->users[$i]['team'] == $this->battle->info['team_win']) {
if ($this->battle->i->dungeon == 0 && $this->battle->i->razdel == 5 && $this->battle->users[$i]['team'] == $this->battle->i->getTeamwin()) {
//ТУТ2
StatsModel::addRepexpById($this->battle->users[$i]['id'], 2); //Репутация за поб в хаоте +2
$check = mysql_fetch_array(
@@ -1234,7 +1232,7 @@ class Finish
}
//Награда за клан вар
if ($this->battle->info['dungeon'] == 0 && $this->battle->info['type'] == 250 && $this->battle->users[$i]['team'] == $this->battle->info['team_win']) {
if ($this->battle->i->dungeon == 0 && $this->battle->i->type == 250 && $this->battle->users[$i]['team'] == $this->battle->i->getTeamwin()) {
mysql_query(
'UPDATE `users_achiv` SET `kw`= `kw`+1 WHERE `id` = "' . $this->battle->users[$i]['id'] . '" LIMIT 1'
);
@@ -1244,16 +1242,16 @@ class Finish
}
//Награда за клан вар
if (
$this->battle->info['dungeon'] == 0 &&
$this->battle->info['type'] == 99 &&
$this->battle->users[$i]['team'] == $this->battle->info['team_win'] &&
$this->battle->i->dungeon == 0 &&
$this->battle->i->type == 99 &&
$this->battle->users[$i]['team'] == $this->battle->i->getTeamwin() &&
(date('w') == 0 || date('w') == 6 || date('w') == 5)
) {
StatsModel::addRepexpById($this->battle->users[$i]['id'], 10); //Кровавые войны(победа) 10
}
//Новая выдача на трупожора
if ($this->battle->info['dungeon'] == 0 && $this->battle->info['type'] == 500 && $this->battle->users[$i]['team'] == $this->battle->info['team_win'] && $this->battle->users[$i]['no_ip'] != 'trupojor' && $this->battle->users[$i]['bot'] == 0) {
if ($this->battle->i->dungeon == 0 && $this->battle->i->type == 500 && $this->battle->users[$i]['team'] == $this->battle->i->getTeamwin() && $this->battle->users[$i]['no_ip'] != 'trupojor' && $this->battle->users[$i]['bot'] == 0) {
if ($this->battle->users[$i]['level'] > 9) {
$mid = 903093;
} else {
@@ -1322,7 +1320,7 @@ class Finish
}
if (
($this->battle->info['razdel'] == 5 || $this->battle->info['razdel'] == 4) &&
($this->battle->i->razdel == 5 || $this->battle->i->razdel == 4) &&
(date('d.m') == '31.10' || (date('m') == 11 && date('d') < 7))
) {
//Хэллоуин 4504
@@ -1333,8 +1331,8 @@ class Finish
//Добавляем воинственность
if (
$this->battle->info['dungeon'] == 0 &&
$this->battle->info['razdel'] == 5 &&
$this->battle->i->dungeon == 0 &&
$this->battle->i->razdel == 5 &&
$this->battle->users[$i]['exp'] >= 1500 &&
$this->battle->users[$i]['battle_exp'] > 100 * $this->battle->users[$i]['level']
) {
@@ -1356,7 +1354,7 @@ class Finish
$rzbvo = 250;
}
if ($this->battle->info['type'] != 33) {
if ($this->battle->i->type != 33) {
$this->battle->users[$i]['battle_text'] .= ' Вы получили ' . $rzbvo . ' воинственности за этот бой.';
}
mysql_query(
@@ -1371,13 +1369,13 @@ class Finish
if ($this->battle->stats[$i]['hpNow'] >= 1) {
$this->battle->stats[$i]['test_heal'] = mysql_fetch_array(
mysql_query(
'SELECT SUM(`yrn`) FROM `battle_stat` WHERE `uid2` = "' . $this->battle->users[$i]['id'] . '" AND `battle` = "' . $this->battle->info['id'] . '" LIMIT 1'
'SELECT SUM(`yrn`) FROM `battle_stat` WHERE `uid2` = "' . $this->battle->users[$i]['id'] . '" AND `battle` = "' . $this->battle->i->id . '" LIMIT 1'
)
);
$this->battle->stats[$i]['test_heal'] = $this->battle->stats[$i]['test_heal'][0];
$this->battle->stats[$i]['test_start'] = mysql_fetch_array(
mysql_query(
'SELECT `hpStart` FROM `battle_users` WHERE `uid` = "' . $this->battle->users[$i]['id'] . '" AND `battle` = "' . $this->battle->info['id'] . '" LIMIT 1'
'SELECT `hpStart` FROM `battle_users` WHERE `uid` = "' . $this->battle->users[$i]['id'] . '" AND `battle` = "' . $this->battle->i->id . '" LIMIT 1'
)
);
$this->battle->stats[$i]['test_start'] = $this->battle->stats[$i]['test_start']['hpStart'];
@@ -1392,7 +1390,7 @@ class Finish
unset($this->battle->stats[$i]['test_heal']);
$this->battle->users[$i]['last_b'] = $this->battle->info['id']; //stats
$this->battle->users[$i]['last_b'] = $this->battle->i->id; //stats
$this->battle->users[$i]['last_a'] = $act01;
$this->battle->users[$i]['battle'] = -1; //users
$this->battle->users[$i]['battle_yron'] = 0; //stats
@@ -1403,9 +1401,9 @@ class Finish
if ($this->battle->users[$i]['clan'] > 0) {
$cpr = 1;
if ($this->battle->info['typeBattle'] == 9) {
if ($this->battle->i->typebattle == 9) {
$cpr = 25;
} elseif ($this->battle->info['typeBattle'] == 50) {
} elseif ($this->battle->i->typebattle == 50) {
$cpr = 65;
}
if ($this->battle->stats[$i]['silver'] >= 5) {
@@ -1420,7 +1418,7 @@ class Finish
$this->battle->users[$i]['battle_exp'] = 0; //stats
if ($this->battle->users[$i]['team'] == $this->battle->info['team_win']) {
if ($this->battle->users[$i]['team'] == $this->battle->i->getTeamwin()) {
$r = new Reputation($this->battle->users[$i]['id']);
$r->addRep('n_capitalcity', $this->battle->users[$i]['bn_capitalcity']);
$r->addRep('n_demonscity', $this->battle->users[$i]['bn_demonscity']);
@@ -1437,7 +1435,7 @@ class Finish
$this->dieInDungeon($dnr, $i, $u, $cmsg, $chat);
Db::sql('update users set login2 = default where battle = ?', [$this->battle->info['id']]);
Db::sql('update users set login2 = default where battle = ?', [$this->battle->i->id]);
Db::sql(
'update users set login2 = default, money = ?, money2 = ?, win = ?, lose = ?, nich = ?, battle = -1 where id = ?',
[
@@ -1465,21 +1463,21 @@ class Finish
$this->battle->users[$i]['exp'],
$this->battle->users[$i]['battle_exp'],
$this->battle->users[$i]['battle_text'],
$this->battle->info['id'],
$this->battle->i->id,
$this->battle->users[$i]['id'],
]
);
if ($this->battle->info['turnir'] == 0) {
if ($this->battle->i->turnir == 0) {
//пишем в чат
$cmsg->setTo($this->battle->users[$i]['login']);
$cmsg->setText($this->battle->users[$i]['battle_text']);
$chat->sendMsg($cmsg);
} else {
Db::sql('update turnirs set winner = ? where id = ?', [$this->battle->info['team_win'], $this->battle->info['turnir']]);
Db::sql('update turnirs set winner = ? where id = ?', [$this->battle->i->getTeamwin(), $this->battle->i->turnir]);
}
//завершаем сам бой
Db::sql('update battle set time_over = unix_timestamp(), team_win = ? where id = ?', [$this->battle->info['team_win'], $this->battle->info['id']]);
Db::sql('update battle set time_over = unix_timestamp(), team_win = ? where id = ?', [$this->battle->i->getTeamwin(), $this->battle->i->id]);
// Жрать хочет
if ($this->battle->users[$i]['animal'] > 0) {
@@ -1512,7 +1510,7 @@ class Finish
}
}
}
mysql_query('UPDATE `battle` SET `testfinish` = "0" WHERE `id` = "' . $this->battle->info['id'] . '" LIMIT 1');
mysql_query('UPDATE `battle` SET `testfinish` = "0" WHERE `id` = "' . $this->battle->i->id . '" LIMIT 1');
}
@@ -1593,11 +1591,11 @@ class Finish
{
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->battle->info['id'], $this->battle->hodID]
[$this->battle->i->id, $this->battle->hodID]
);
Db::sql('delete from battle_logs where battle = ?', [$this->battle->info['id']]);
Db::sql('delete from battle_stat where battle < ?', [$this->battle->info['id'] - 100]);
Db::sql('delete from battle_actions where btl = ?', [$this->battle->info['id']]);
Db::sql('delete from battle_logs where battle = ?', [$this->battle->i->id]);
Db::sql('delete from battle_stat where battle < ?', [$this->battle->i->id - 100]);
Db::sql('delete from battle_actions where btl = ?', [$this->battle->i->id]);
}
private function dieInDungeon(int $dnr, int $i, User $u, ChatMessage $cmsg, Chat $chat): void
@@ -1622,7 +1620,7 @@ class Finish
$la = $this->battle->users[$i]['sex'] == 1 ? 'ла' : '';
if ($dies < 2 || $this->battle->info['dungeon'] == 15) {
if ($dies < 2 || $this->battle->i->dungeon == 15) {
$shaibaItemId = Db::getValue('select id from items_users where uid = ? and item_id = 4910 limit 1', [$this->battle->users[$i]['id']]);
@@ -1633,7 +1631,7 @@ class Finish
"insert into dungeon_obj (name, dn, x, y, img, action, w, h, os1, os2, os3, date)
values ('Шайба',?,?,?,'shaiba.png','fileact:15/shaiba',120,220,5,8,12,?)",
[
$this->battle->info['dn_id'],
$this->battle->i->dnId,
$this->battle->users[$i]['x'],
$this->battle->users[$i]['y'],
"{use:'takeit',rt1:69,rl1:-47,rt2:74,rl2:126,rt3:76,rl3:140,rt4:80,rl4:150}",
@@ -1651,7 +1649,7 @@ class Finish
$reviveRoomName = $this->battle->users[$i]['room'] == 370 ? 'начале лабиринта' : "комнате «{$roomName}»";
$rtxt = "<strong>{$this->battle->users[$i]['login']}</strong> трагически погиб$la и находится в $reviveRoomName";
} elseif ($this->battle->info['dungeon'] == 102) {
} elseif ($this->battle->i->dungeon == 102) {
$nld = '';
$lab = Db::getRow('select id, users from laba_now where id = ?', [$this->battle->users[$i]['id']]);
@@ -1689,14 +1687,14 @@ class Finish
} else {
$tinf = mysql_fetch_array(
mysql_query(
'SELECT `uid` FROM `dungeon_now` WHERE `id` = "' . $this->battle->info['dn_id'] . '" LIMIT 1'
'SELECT `uid` FROM `dungeon_now` WHERE `id` = "' . $this->battle->i->dnId . '" LIMIT 1'
)
);
$nld = '';
if ($tinf['uid'] == $this->battle->users[$i]['id']) {
$tinf = mysql_fetch_array(
mysql_query(
'SELECT `id` FROM `stats` WHERE `dnow` = "' . $this->battle->info['dn_id'] . '" AND `hpNow` >= 1 LIMIT 1'
'SELECT `id` FROM `stats` WHERE `dnow` = "' . $this->battle->i->dnId . '" AND `hpNow` >= 1 LIMIT 1'
)
);
if (isset($tinf['id'])) {
@@ -1707,7 +1705,7 @@ class Finish
);
$nld .= ', новым лидером становится &quot;' . $tinf['login'] . '&quot;';
mysql_query(
'UPDATE `dungeon_now` SET `uid` = "' . $tinf['id'] . '" WHERE `id` = "' . $this->battle->info['dn_id'] . '" LIMIT 1'
'UPDATE `dungeon_now` SET `uid` = "' . $tinf['id'] . '" WHERE `id` = "' . $this->battle->i->dnId . '" LIMIT 1'
);
}
}
@@ -1733,7 +1731,7 @@ class Finish
}
}
if (!empty($rtxt)) {
$cmsg->setDn($this->battle->info['dn_id']);
$cmsg->setDn($this->battle->i->dnId);
$cmsg->setText($rtxt);
$cmsg->setTypeTime(1);
$chat->sendMsg($cmsg);