WIP: перед введенимем класса Fighter.php

This commit is contained in:
2024-01-06 00:14:35 +02:00
parent 07f905ef64
commit a2c658166d
67 changed files with 5555 additions and 7135 deletions
+36 -45
View File
@@ -24,6 +24,8 @@ class Finish
private int $aBexp = 0; //Добавочный опыт в боях
private Battle $battle;
private array $btlstatus = [];
public function __construct(Battle $battle)
{
$this->battle = $battle;
@@ -35,7 +37,6 @@ class Finish
$injuryName = [1 => 'легкую', 2 => 'среднюю', 3 => 'тяжелую', 4 => 'неизлечимую',];
$dnr = 0; //???
$chat = new Chat();
mysql_query('LOCK TABLES users,stats,battle,battle_last,battle_end,chat WRITE');
$test = Db::getRow('select id, team_win, testfinish from battle where id = ? and team_win != -1', [$this->battle->info['id']]);
if ($test['testfinish'] == -1) {
@@ -259,7 +260,7 @@ class Finish
);
}
unset($spik, $plik);
//
$usrreal = '';
$usr_real = mysql_fetch_array(
mysql_query(
@@ -270,13 +271,9 @@ class Finish
$usr_real = $this->battle->users[$i];
}
if (isset($usr_real['id'])) {
if ($usr_real['align'] > 0) {
$usrreal .= '<img src=//img.new-combats.tech/i/align/align' . $usr_real['align'] . '.gif width=12 height=15 >';
}
if ($usr_real['clan'] > 0) {
$usrreal .= '<img src=//img.new-combats.tech/i/clan/' . $usr_real['clan'] . '.gif width=24 height=15 >';
}
$usrreal .= '<strong>' . $usr_real['login'] . '</strong>[' . $usr_real['level'] . ']<a target=_blank href=/info/' . $usr_real['id'] . ' ><img src=//img.new-combats.tech/i/inf_capitalcity.gif alt=""></a>';
$login = new User\Login($usr_real['align'], $usr_real['clan'], $usr_real['level'], $usr_real['login']);
$usrreal .= $login->fullLogin;
unset($login);
}
$text = str_replace('{u1}', $usrreal, $text);
@@ -357,14 +354,14 @@ class Finish
$usrwin = '';
while ($j < count($this->battle->users)) {
if ($this->battle->users[$j]['no_ip'] != 'trupojor' && $this->battle->users[$j]['bot'] == 0 && $this->battle->stats[$j]['hpNow'] > 0) {
$usrwin .= ', ';
if ($this->battle->users[$j]['align'] > 0) {
$usrwin .= '<img width=12 height=15 src=//img.new-combats.tech/i/align/align' . $this->battle->users[$j]['align'] . '.gif >';
}
if ($this->battle->users[$j]['clan'] > 0) {
$usrwin .= '<img width=24 height=15 src=//img.new-combats.tech/i/clan/' . $this->battle->users[$j]['clan'] . '.gif >';
}
$usrwin .= '<strong>' . $this->battle->users[$j]['login'] . '</strong> [' . $this->battle->users[$j]['level'] . ']<a target=_blank href=info/' . $this->battle->users[$j]['id'] . ' ><img alt="" src=//img.new-combats.tech/i/inf_capitalcity.gif ></a>';
$login = new User\Login(
$this->battle->users[$j]['align'],
$this->battle->users[$j]['clan'],
$this->battle->users[$j]['level'],
$this->battle->users[$j]['login']
);
$usrwin .= ', ' . $login->fullLogin;
unset($login);
}
$j++;
}
@@ -950,9 +947,11 @@ class Finish
)
);
$btlstatus = $this->typeBattle($prsusers[0]);
$this->btlstatus = Battle::getType($prsusers[0]);
if ($this->battle->info['smert'] == 1) {
$btlstatus = [150, 150, 'Жесточайшее Сражение', 'Жесточайшее Сражение'];
$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)) {
@@ -961,11 +960,11 @@ class Finish
unset($r1);
//Статусная битва
if ($btlstatus[0] > 0) {
if ($this->btlstatus[0] > 0) {
if ($this->battle->info['type'] == 99) {
$this->battle->info['addExp'] += $btlstatus[1];
$this->battle->info['addExp'] += $this->btlstatus[1];
} else {
$this->battle->info['addExp'] += $btlstatus[0];
$this->battle->info['addExp'] += $this->btlstatus[0];
}
}
@@ -1126,11 +1125,11 @@ class Finish
unset($lime);
if ($btlstatus[0] > 0) {
if ($this->btlstatus[0] > 0) {
if ($this->battle->info['type'] == 99) {
$prc .= ' (' . $btlstatus[3] . ')';
$prc .= ' (' . $this->btlstatus[3] . ')';
} else {
$prc .= ' (' . $btlstatus[2] . ')';
$prc .= ' (' . $this->btlstatus[2] . ')';
}
}
@@ -1504,13 +1503,17 @@ class Finish
mysql_query('UPDATE `battle_users` SET `finish` = 1 WHERE `uid` = "' . $this->battle->users[$i]['id'] . '"');
$this->saveLogs();
if ($u->info['battle'] != 0 && !isset($u->info['battle_lsto'])) {
echo '<script>document.getElementById(\'teams\').style.display=\'none\';var battleFinishData = "' . $u->info['battle_text'] . '";</script>';
echo <<<HTML
<script>
document.getElementById('teams').style.display='none';
var battleFinishData = {$u->info['battle_text']}
</script>
HTML;
}
}
}
mysql_query('UPDATE `battle` SET `testfinish` = "0" WHERE `id` = "' . $this->battle->info['id'] . '" LIMIT 1');
mysql_query('UNLOCK TABLES');
}
private function addItemToItemsLocal(int $itemId, int $uid, string $data = ''): void
@@ -1597,23 +1600,6 @@ class Finish
Db::sql('delete from battle_actions where btl = ?', [$this->battle->info['id']]);
}
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;
}
private function dieInDungeon(int $dnr, int $i, User $u, ChatMessage $cmsg, Chat $chat): void
{
if ($dnr != 1) {
@@ -1913,4 +1899,9 @@ class Finish
}
public function getBtlstatus(): array
{
return $this->btlstatus;
}
}