Часть логов теперь пишется в SQLITE, а не в текстовые файлы (#33). Проинициализирован класс Nick в свитках.

This commit is contained in:
Igor Barkov (iwork)
2021-08-26 17:44:14 +03:00
parent 6fa217b93b
commit 5e264f837a
65 changed files with 438 additions and 233 deletions
+12 -7
View File
@@ -1,5 +1,10 @@
<?php
use Battles\Chat;
use Battles\DressedItems;
use Battles\GameLogs;
use Battles\Nick;
use Battles\Template;
use Battles\User;
require_once "functions.php";
@@ -131,7 +136,7 @@ if ($_POST['attack']) {
$ttt2 = 2;
}
addch("<b>" . Nick::id($user['id'])->short() . "</b> вмешался в <a href=logs.php?log=" . $id . " target=_blank>поединок »»</a>.", $user->getRoom());
addlog($jert['battle'], '<span class=date>' . date("H:i") . '</span> ' . Nick::id($user['id'])->short() . ' вмешался в поединок!<BR>');
GameLogs::addBattleLog($jert['battle'], '<span class=date>' . date("H:i") . '</span> ' . Nick::id($user['id'])->short() . ' вмешался в поединок!<BR>');
mysql_query('UPDATE `battle` SET `teams` = \'' . serialize($battle) . '\', `t' . $ttt . '` = CONCAT(`t' . $ttt . '`,\';' . $user['id'] . '\'), `to' . $ttt . '` = \'' . time() . '\', `to' . $ttt2 . '` = \'' . (time() - 1) . '\' WHERE `id` = "' . $jert['battle'] . '" LIMIT 1');
mysql_query("UPDATE `users` SET `battle` = '" . $jert['battle'] . "', `zayavka` = 0 WHERE `id` = '" . $user['id'] . "' LIMIT 1");
mysql_query('UPDATE `deztow_turnir` SET `log` = CONCAT(`log`,\'' . "<span class=date>" . date("d.m.y H:i") . "</span> " . Nick::id($user['id'])->full(1) . " вмешался в поединок против " . Nick::id($jert['id'])->full(1) . " <a href=\"logs.php?log={$jert['battle']}\" target=_blank>»»</a><BR>" . '\') WHERE `active` = TRUE LIMIT 1');
@@ -157,7 +162,7 @@ if ($_POST['attack']) {
$rr = "<b>" . Nick::id($user['id'])->full(1) . "</b> и <b>" . Nick::id($jert['id'])->full(1) . "</b>";
addch("<B><b>" . Nick::id($user['id'])->short() . "</b> , применив магию нападения, внезапно напал на <b>" . Nick::id($jert['id'])->short() . "</b>.", $user->getRoom());
addlog($id, "Часы показывали <span class=date>" . date("Y.m.d H.i") . "</span>, когда " . $rr . " бросили вызов друг другу. <BR>");
GameLogs::addBattleLog($id, "Часы показывали <span class=date>" . date("Y.m.d H.i") . "</span>, когда " . $rr . " бросили вызов друг другу. <BR>");
mysql_query("UPDATE `users` SET `battle` = {$id}, `zayavka` = 0 WHERE (`id` = {$user['id']} OR `id` = {$jert['id']})");
mysql_query('UPDATE `deztow_turnir` SET `log` = CONCAT(`log`,\'' . "<span class=date>" . date("d.m.y H:i") . "</span> " . Nick::id($user['id'])->full(1) . " напал на " . Nick::id($jert['id'])->full(1) . " завязался <a href=\"logs.php?log={$id}\" target=_blank>бой »»</a><BR>" . '\') WHERE `active` = TRUE LIMIT 1');
header("Location: fbattle.php");
@@ -193,7 +198,7 @@ if ($rhar[$user->getRoom()][$_GET['path']] > 0 && $_GET['path'] < 5 && $_GET['pa
$list = mysql_query("SELECT * FROM `users` WHERE `in_tower` = 1 AND `battle` = 0");
while ($u = mysql_fetch_array($list)) {
if ($u['hp'] <= 0) {
\Battles\DressedItems::undressAllItems($u['id']);
DressedItems::undressAllItems($u['id']);
$rep = mysql_query("SELECT * FROM `inventory` WHERE `owner` = '" . $u['id'] . "' AND `bs` = 1");
while ($r = mysql_fetch_array($rep)) {
mysql_query("INSERT `deztow_items` (`iteam_id`, `name`, `img`, `room`) VALUES ('" . $r['prototype'] . "', '" . $r['name'] . "', '" . $r['img'] . "', '" . $u['room'] . "')");
@@ -227,7 +232,7 @@ while ($u = mysql_fetch_array($list)) {
if (($kol_pl + $ls) < 2 && ($tur_data['start_time'] + 60) <= time()) {
$tur = mysql_fetch_array(mysql_query("SELECT * FROM `deztow_turnir` WHERE `active` = TRUE LIMIT 1"));
\Battles\DressedItems::undressAllItems($user['id']);
DressedItems::undressAllItems($user['id']);
$rep = mysql_query("SELECT * FROM `inventory` WHERE `owner` = '" . $user['id'] . "' AND `bs` = 1");
while ($r = mysql_fetch_array($rep)) {
mysql_query("INSERT `deztow_items` (`iteam_id`, `name`, `img`, `room`) VALUES ('" . $r['prototype'] . "', '" . $r['name'] . "', '" . $r['img'] . "', '" . $user->getRoom() . "');");
@@ -247,7 +252,7 @@ if (($kol_pl + $ls) < 2 && ($tur_data['start_time'] + 60) <= time()) {
mysql_query('UPDATE `deztow_turnir` SET `winner` = \'' . $user['id'] . '\', `winnerlog` = \'' . Nick::id($user['id'])->full(1) . '\', `endtime` = \'' . time() . '\', `active` = FALSE, `log` = CONCAT(`log`,\'' . "<span class=date>" . date("d.m.y H:i") . "</span> Турнир завершен. Победитель : " . Nick::id($user['id'])->full(1) . " Приз : <b>" . $tur['coin'] . "</b> кр. <br />" . '\') WHERE `active` = TRUE LIMIT 1');
addchp('<font color=red>Внимание!</font> Поздравляем! Вы победитель турнира Башни смерти! Получаете <b>' . $tur['coin'] . '</b> кр.', '{[]}' . $user['login'] . '{[]}');
AddChatSystem('<font color=red>Внимание!</font> Битва в Башне Смерти завершена. Победитель : <b>' . $user['login'] . ' [' . $user['level'] . ']</b>');
Chat::addSYSMessage('Внимание! Битва в Башне Смерти завершена. Победитель:' . $user['login'] . ' [' . $user['level'] . ']');
if ($tur['art'] == 1) {
$bs_art = 0;
} else {
@@ -268,7 +273,7 @@ if ($user['hp'] <= 0) {
header('Location: tower.php');
exit;
}
\Battles\Template::header('towerin');
Template::header('towerin');
?>
<script>
let Hint3Name = '';
@@ -661,7 +666,7 @@ if ($user['hp'] <= 0) {
<script language="javascript" type="text/javascript">
const progressEnd = 32;
let progressColor = '#00CC00';
let mtime = parseInt('<?=($_SESSION["time"]-time())?>');
let mtime = parseInt('<?=($_SESSION["time"] - time())?>');
if (!mtime || mtime <= 0) {
mtime = 0;
}