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
+29 -22
View File
@@ -383,10 +383,12 @@ class FightRequest
/**
* Звуковой пинг в чат?
* @param string $to
* @param int $room
* @return void
* @todo убрать колхоз с условиями когда станет ясно как оно работает.
*/
private function sendSysChatSound(string $to = '', int $room = 0)
private function sendSysChatSound(string $to = '', int $room = 0): void
{
$cmsg = new ChatMessage();
if (empty($to)) {
@@ -399,9 +401,9 @@ class FightRequest
} else {
$cmsg->setRoom($room);
}
$cmsg->setCity($this->u->info['city']);
$cmsg->setType(11);
$cmsg->setSound(117);
$cmsg->setText('Ваш бой начался!');
(new Chat())->sendMsg($cmsg);
}
@@ -621,6 +623,7 @@ class FightRequest
$nz['time_start'] = 600;
}
if (isset($_POST['mut_hidden'])) {
$nz['invise'] = 1;
}
@@ -817,19 +820,17 @@ class FightRequest
return isset($symbols[1]) ? $symbols[0] . '.' . $symbols[1] : $symbols[0] . '.0';
}
public function getEndedBattlesList(string $slogin, int $dt)
public function getEndedBattlesList(string $slogin, int $dt): void
{
$code = PassGen::intCode();
$btl = '';
$see = '';
$usr = Db::getRow('select id, login, level, city from users where login = ? limit 1', [$slogin]);
if (isset($usr['id'])) {
$tms = $dt;
$tmf = $dt + 86400;
$uid = Db::getValue('select id from users where login = ? limit 1', [$slogin]);
if ($uid) {
$sp = Db::getRows(
'select * from battle_last where time >= ? and time < ? and uid = ? order by id desc ',
[$tms, $tmf, $usr['id']]
[$dt, $dt + 86400, $uid]
);
$jk = 0;
$btl_lst = [];
@@ -840,11 +841,13 @@ class FightRequest
$tms = [];
$ts = [];
$spi = Db::getRows('select * from battle_last where battle_id = ?', [$pl['battle_id']]);
foreach ($spi as $pli) {
if (!isset($tms[$pli['team']])) {
$ts[] = $pli['team'];
}
$tms[$pli['team']][count($tms[$pli['team']])] = $pli;
$tms[$pli['team']][] = $pli;
}
$k = 0;
while ($k < count($ts)) {
@@ -859,7 +862,7 @@ class FightRequest
}
$tm2 .= '<b>' . $tms[$g][$h]['login'] . '</b> [' . $tms[$g][$h]['lvl'] . ']
<a href="info/' . $tms[$g][$h]['uid'] . '" target="_blank">
<img src="' . Config::img() . '/i/inf_capitalcity.gif" alt=""></a>, ';
<img src="' . Config::img() . '/i/inf.gif" alt=""></a>, ';
}
$h++;
}
@@ -875,20 +878,24 @@ class FightRequest
$k++;
}
}
if (!isset($btl_lst[$b['id']])) {
$btl_lst[$b['id']] = true;
if ($tm == '') {
$tm = 'Данные поединка потеряны';
}
$jk++;
$btl .= $jk . '. <span class=date>' . date(
'd.m.y H:i', $pl['time']
) . '</span> ' . $tm . ' <A HREF="logs.php?log=' . $pl['battle_id'] . '&rnd=' . $code . '" target=_blank>»»</A><br>';
if (isset($btl_lst[$b['id']])) {
continue;
}
$btl_lst[$b['id']] = true;
if ($tm == '') {
$tm = 'Данные поединка потеряны';
}
$jk++;
$btl .= $jk . '. <span class=date>' . date('d.m.y H:i', $pl['time']) . '</span> ' .
$tm . ' <a href="/logs.php?log=' . $pl['battle_id'] . '&rnd=' . $code . '" target=_blank>»»</a><br>';
}
}
$see .= empty($btl) ? '<div style="font-weight: bold;">В этот день не было боев, или же, летописец опять потерял свитки...</div><hr><br>' : $btl;
echo $see;
echo empty($btl) ?
'<div style="font-weight: bold;">В этот день не было боев, или же, летописец опять потерял свитки...</div><hr><br>' :
$btl;
}
public function getCurrentBattlesList(): void