battles/stat_battle.php

366 lines
13 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
$log = file("backup/battle_stat/battle" . $_REQUEST['log'] . ".txt");
$unique = [];
$hits = [];
foreach ($log as $k) {
$r = explode("|", $k);
if (!$r[2]) {
$r[2] = 665;
}
$hits[][$r[0]]['hits'] = $r[1];
if (!in_array($r[0], $unique)) {
$unique[] = $r[0];
}
}
?>
<html>
<head>
<link rel="stylesheet" href="css/main.css"/>
<meta charset=utf-8">
<style>
.b3 {
font-weight: bold;
color: #269088;
}
.b4 {
font-weight: bold;
color: #A0AF20;
}
.b5 {
font-weight: bold;
color: #0F79D3;
}
.b6 {
font-weight: bold;
color: #D85E23;
}
.b7 {
font-weight: bold;
color: #5C832F;
}
.b8 {
font-weight: bold;
color: #842B61;
}
.b9 {
font-weight: bold;
color: navy;
}
</style>
</head>
<body leftmargin=5 topmargin=5 marginwidth=5 marginheight=5 bgcolor=e2e0e0>
<h3>Статистика боя</h3>
Тип боя:
Продолжительность боя: мин.
<FORM METHOD=GET ACTION="logs.php">
<INPUT TYPE=hidden name=analiz value="1293752125.55927">
<INPUT TYPE=submit name=log2 value="Лог боя">
</FORM>
<H4>Последовательность ударов</H4>
<TABLE border=1 cellspacing=0 cellpadding=4>
<TR>
<TD align=center>Логин</TD>
<TD>Удар в</TD>
<TD>Последовательность ударов</TD>
</TR>
<?php
$an = "<font color=\"#e2e2e2\">";
$an2 = "</font>";
asort($unique);
foreach ($unique as $u) {
echo "
<TR>
<TD align=left>" . $u . "</TD>
<TD align=right><code>голову<br>грудь<br>живот<br>пояс<br>ноги</code></TD>
<TD>";
$c = count($hits);
$excl = [2, 3, 4, 5];
for ($i = 0; $i <= $c; $i++) {
if (!$hits[$i][$u]['hits']) {
$i++;
}
if ($hits[$i][$u]['hits'] == 1) {
echo "<b>X</b>";
} elseif ($hits[$i][$u]['hits'] == 665) {
echo "<font color=\"green\"><b>X</b></font>";
} elseif (in_array($hits[$i][$u]['hits'], $excl)) {
echo "$an<b>X</b>$an2";
}
}
echo "<br>";
$excl = [1, 3, 4, 5, 665];
for ($i = 0; $i < $c; $i++) {
if (!$hits[$i][$u]['hits']) {
$i++;
}
if ($hits[$i][$u]['hits'] == 2) {
echo "<b>X</b>";
} elseif (in_array($hits[$i][$u]['hits'], $excl)) {
echo "$an<b>X</b>$an2";
}
}
echo "<br>";
$excl = [1, 2, 4, 5, 665];
for ($i = 0; $i < $c; $i++) {
if (!$hits[$i][$u]['hits']) {
$i++;
}
if ($hits[$i][$u]['hits'] == 3) {
echo "<b>X</b>";
} elseif (in_array($hits[$i][$u]['hits'], $excl)) {
echo "$an<b>X</b>$an2";
}
}
echo "<br>";
$excl = [1, 3, 2, 5, 665];
for ($i = 0; $i < $c; $i++) {
if (!$hits[$i][$u]['hits']) {
$i++;
}
if ($hits[$i][$u]['hits'] == 4) {
echo "<b>X</b>";
} elseif (in_array($hits[$i][$u]['hits'], $excl)) {
echo "$an<b>X</b>$an2";
}
}
echo "<br>";
$excl = [1, 3, 4, 2, 665];
for ($i = 0; $i < $c; $i++) {
if (!$hits[$i][$u]['hits']) {
$i++;
}
if ($hits[$i][$u]['hits'] == 5) {
echo "<b>X</b>";
} elseif (in_array($hits[$i][$u]['hits'], $excl)) {
echo "$an<b>X</b>$an2";
}
}
echo "<br>";
echo "
</TD>
</TR>
";
}
?>
</TABLE>
(<b>X</b>&nbsp;-&nbsp;удачный&nbsp;удар, <font color=red><B>X</B></font>&nbsp;-&nbsp;критический&nbsp;удар, <font
color=red><B><code>&Xi;</code></B></font>&nbsp;-&nbsp;крит + инвалидность, <font color=006600><B>X</B></font>&nbsp;-&nbsp;доп.&nbsp;магический&nbsp;удар,<BR>
&nbsp;<B>&bull;</B>&nbsp;-&nbsp;противник&nbsp;блокировал&nbsp;удар, <font color=AAAAAA><B>&bull;</B></font>&nbsp;-&nbsp;увернулся,
<font color=AAAAEE><B>&bull;</B></font>&nbsp;-&nbsp;парировал, <font color=777777><B>&bull;</B></font>&nbsp;-&nbsp;отбил
удар щитом)
<H4>Последовательность блоков</H4>
<TABLE border=1 cellspacing=0 cellpadding=4>
<TR>
<TD align=center>Логин</TD>
<TD>Блок</TD>
<TD>Последовательность блоков</TD>
</TR>
<?
$unique = [];
$hits = [];
foreach ($log as $k) {
$r = explode("|", $k);
if (!$r[2]) {
$r[2] = 665;
}
$defs = explode(",", $r[2]);
foreach ($defs as $k => $dd) {
$hits[][$r[0]]['defs'][$k] = $dd;
}
if (!in_array($r[0], $unique)) {
$unique[] = $r[0];
}
}
$an = "<font color=\"#e2e2e2\">";
$an2 = "</font>";
asort($unique);
foreach ($unique as $u) {
echo "<TR><TD align=left>" . $u . "</TD><TD align=right><code>голова<br>грудь<br>живот<br>пояс<br>ноги</code></TD><TD>";
$c = count($hits) - 1;
$excl = ["00", "01", "10", "11"];
for ($i = 0; $i <= $c; $i++) {
if (!in_array($hits[$i][$u]['defs'][0], $excl)) {
$i++;
}
if ($hits[$i][$u]['defs'][0] == "11") {
echo "<b>X</b>";
} elseif ($hits[$i][$u]['defs'][0] == "10") {
echo "<b>•</b>";
} else {
echo "$an<b>X</b>$an2";
}//}
}
echo "<br>";
for ($i = 0; $i <= $c; $i++) {
if (!in_array($hits[$i][$u]['defs'][1], $excl)) {
$i++;
}
if ($hits[$i][$u]['defs'][1] == "11") {
echo "<b>X</b>";
} elseif ($hits[$i][$u]['defs'][1] == "10") {
echo "<b>•</b>";
} else {
echo "$an<b>X</b>$an2";
}//}
}
echo "<br>";
for ($i = 0; $i <= $c; $i++) {
if (!in_array($hits[$i][$u]['defs'][2], $excl)) {
$i++;
}
if ($hits[$i][$u]['defs'][2] == "11") {
echo "<b>X</b>";
} elseif ($hits[$i][$u]['defs'][2] == "10") {
echo "<b>•</b>";
} else {
echo "$an<b>X</b>$an2";
}//}
}
echo "<br>";
for ($i = 0; $i <= $c; $i++) {
if (!in_array($hits[$i][$u]['defs'][3], $excl)) {
$i++;
}
if ($hits[$i][$u]['defs'][3] == "11") {
echo "<b>X</b>";
} elseif ($hits[$i][$u]['defs'][3] == "10") {
echo "<b>•</b>";
} else {
echo "$an<b>X</b>$an2";
}//}
}
echo "<br>";
for ($i = 0; $i <= $c; $i++) {
if (!in_array($hits[$i][$u]['defs'][4], $excl)) {
$i++;
}
if ($hits[$i][$u]['defs'][4] == "11") {
echo "<b>X</b>";
} elseif ($hits[$i][$u]['defs'][4] == "10") {
echo "<b>•</b>";
} else {
echo "$an<b>X</b>$an2";
}//}
}
echo "</TD></TR>";
}
?>
</TABLE>
(<b>X</b>&nbsp;-&nbsp;удачный блок, <b><FONT COLOR=red>X</FONT></b>&nbsp;-&nbsp;пробили блок критом, <B>&bull;</B>&nbsp;-&nbsp;пропустил
удар,
<font color=#AAAAAA><B>&bull;</B></font>&nbsp;-&nbsp;увернулся
<font color=#AAAAEE><B>&bull;</B></font>&nbsp;-&nbsp;парировал
<font color=#777777><B>&bull;</B></font>&nbsp;-&nbsp;отбил щитом)
<?php
$summary = file("backup/stat/battle" . $_REQUEST['log'] . ".txt");
$hit[] = [];
$where_hit[] = [];
$team1_users[] = [];
$team2_users[] = [];
$sum_hp1 = [];
$sum_hp2 = [];
//$data['t1']
//$data['t2']
echo "<br/><br/><br/>";
foreach ($summary as $k) {
//echo $k.'<br/>';
$r = explode("|", $k);
if ($r[5] == 'udar') {
$hit[$r[0]] += $r[6];
}
if ($r[0] == 'user_team1') {
$team1_users[$r[1]] = $r[2];
}
if ($r[0] == 'user_team2') {
$team2_users[$r[1]] = $r[2];
}
if ($r[1] == 'B1' or $r[1] == 'B2') {
$where_hit[$r[0]][$r[4]] += 1;
}
}
?>
<H4>Суммарно</H4>
<TABLE border=1 cellspacing=0 cellpadding=4>
<TR>
<TD align=center>Логин</TD>
<TD>Удары</TD>
<TD>Блоки</TD>
<TD>Попадания</TD>
<TD>Защита</TD>
<TD>Урон</TD>
<TD>Потери</TD>
<TD>Вылечено</TD>
</TR>
<?php
if (strpos($data['t1'], ';')) {
$team1 = explode(";", $data['t1']);
} else {
$team1[0] = $data['t1'];
}
for ($i = 0; $i < count($team1); $i++) {
$sData = substr($team1_users[$team1[$i]], -12);
preg_match('/\[(.*?)\//', $sData, $rgMatches1);
$sum_hp1[1] += substr($rgMatches1[0], 1, strlen($rgMatches1[0]) - 1);
preg_match('/\/(.*?)\]/', $sData, $rgMatches2);
$sum_hp1[2] += substr($rgMatches2[0], 1, strlen($rgMatches2[0]) - 1);
echo "<TR><TD align=right>" . $team1_users[$team1[$i]] . "</TD><TD>" . (!empty($where_hit[$team1[$i]][1]) ? $where_hit[$team1[$i]][1] : 0) . "/" . (!empty($where_hit[$team1[$i]][2]) ? $where_hit[$team1[$i]][2] : 0) . "/" . (!empty($where_hit[$team1[$i]][3]) ? $where_hit[$team1[$i]][3] : 0) . "/" . (!empty($where_hit[$team1[$i]][4]) ? $where_hit[$team1[$i]][4] : 0) . "/" . (!empty($where_hit[$team1[$i]][5]) ? $where_hit[$team1[$i]][5] : 0) . "</TD><TD>0/0/0/0/0</TD><TD align=center>0(<font color=red>0</font>)0</TD><TD align=center>0/0/0</TD><TD align=center>0/<font color=red>0</font></TD><TD align=center>0</TD><TD align=center>0</TD></tr>";
}
echo "<TR><TD align=right><span class=B1>Всего[" . $sum_hp1[1] . "/" . $sum_hp1[2] . "]<span></TD><TD></TD><TD></TD><TD align=center>0</TD><TD align=center>0</TD><TD align=center>0</TD><TD align=center>0</TD><TD align=center>0</TD></tr>";
if (strpos($data['t2'], ';')) {
$team2 = explode(";", $data['t2']);
} else {
$team2[0] = $data['t2'];
}
for ($i = 0; $i < count($team2); $i++) {
$sData = substr($team2_users[$team2[$i]], -12);
preg_match('/\[(.*?)\//', $sData, $rgMatches1);
$sum_hp2[1] += substr($rgMatches1[0], 1, strlen($rgMatches1[0]) - 1);
preg_match('/\/(.*?)\]/', $sData, $rgMatches2);
$sum_hp2[2] += substr($rgMatches2[0], 1, strlen($rgMatches2[0]) - 1);
echo "<TR><TD align=right>" . $team2_users[$team2[$i]] . "</TD><TD>" . (!empty($where_hit[$team2[$i]][1]) ? $where_hit[$team2[$i]][1] : 0) . "/" . (!empty($where_hit[$team2[$i]][2]) ? $where_hit[$team2[$i]][2] : 0) . "/" . (!empty($where_hit[$team2[$i]][3]) ? $where_hit[$team2[$i]][3] : 0) . "/" . (!empty($where_hit[$team2[$i]][4]) ? $where_hit[$team2[$i]][4] : 0) . "/" . (!empty($where_hit[$team2[$i]][5]) ? $where_hit[$team2[$i]][5] : 0) . "</TD><TD>0/0/0/0/0</TD><TD align=center>0(<font color=red>0</font>)0</TD><TD align=center>0/0/0</TD><TD align=center>0/<font color=red>0</font></TD><TD align=center>0</TD><TD align=center>0</TD></tr>";
}
echo "<TR><TD align=right><span class=B2>Всего[" . $sum_hp2[1] . "/" . $sum_hp2[2] . "]</span></TD><TD></TD><TD></TD><TD align=center>0</TD><TD align=center>0</TD><TD align=center>0</TD><TD align=center>0</TD><TD align=center>0</TD></tr>";
?>
</TABLE>
Логин - имя персонажа и уровень жизни: [сейчас/всего]<BR>
Удары - статистика ударов по областям: голова/грудь/живот/пояс/ноги<BR>
Блоки - статистика блоков по областям: голова/грудь/живот/пояс/ноги<BR>
Попадания - удачных попаданий <FONT COLOR=red>(из них критов)</FONT> / всего ударов<BR>
Защита - ударов заблокировано / уворотов / пропущено ударов<BR>
Урон - выбито HP из противников / из них <FONT COLOR=red>критами</FONT><BR>
Потери - получено повреждений <BR>
Вылечено - восстановлено HP<BR>
</BODY>
</HTML>