Файл: html/hunt/command.php
Строк: 222
<?php
require '../system/func.php';
require '../system/dbc.php';
ini_set('error_reporting', E_ALL);
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
//получаем информацию о текущем бое героя
if (isset($user) && $UserArr = $mc->query("SELECT * FROM `battle` WHERE `Mid` = '" . $user['id'] . "' && `Ptype`='0'&& `Plife`>'0' &&`player_activ`='1' &&`end_battle`='0'")->fetch_array(MYSQLI_ASSOC)) {
//command arr
$arrCommand = ["Шейване", "Нармасцы", "Монстры"];
$arrCommandIco = [
"<img height="15" src="/img/icon/icoevil.png" width="15" alt="">",
"<img height="15" src="/img/icon/icogood.png" width="15" alt="">",
""
];
$arr1 = $mc->query("SELECT * FROM `battle` WHERE `battle_id`='" . $UserArr['battle_id'] . "' AND `Pnamevs`!='' LIMIT 1")->fetch_array(MYSQLI_ASSOC);
$arr2 = $mc->query("SELECT * FROM `battle` WHERE `battle_id`='" . $UserArr['battle_id'] . "'ORDER BY `Ruron` DESC")->fetch_all(MYSQLI_ASSOC);
//получаем команду героя и противника
$resUserAllCommand = $mc->query("SELECT * FROM `battle` WHERE `battle_id`='" . $UserArr['battle_id'] . "' AND `command`='" . $arr1['command'] . "' ORDER BY `Ruron` DESC");
$resMobAllCommand = $mc->query("SELECT * FROM `battle` WHERE `battle_id`='" . $UserArr['battle_id'] . "' AND `command`!='" . $arr1['command'] . "' ORDER BY `Ruron` DESC");
if ($resUserAllCommand->num_rows && $resMobAllCommand->num_rows) {
$arrUserAllCommand = $resUserAllCommand->fetch_all(MYSQLI_ASSOC);
$arrMobAllCommand = $resMobAllCommand->fetch_all(MYSQLI_ASSOC);
?>
<?php for ($i = 0; $i < count($arrUserAllCommand); $i++) { ?>
<?php if ($arrUserAllCommand[$i]['Pnamevs'] != "") { ?>
<center>
<?= $arrUserAllCommand[$i]['Pvsname'] != "" && $arrUserAllCommand[0]['command'] < 2 ? $arrCommandIco[$arrUserAllCommand[0]['command']] : ""; ?>
<?= $arrUserAllCommand[$i]['Pnamevs']; ?>
<?= $arrUserAllCommand[$i]['Pvsname'] != "" ? " vs " : ""; ?>
<?= $arrUserAllCommand[$i]['Pvsname'] != "" && $arrMobAllCommand[0]['command'] < 2 ? $arrCommandIco[$arrMobAllCommand[0]['command']] : ""; ?>
<?= $arrUserAllCommand[$i]['Pvsname']; ?>
</center>
<?php } ?>
<?php } ?>
<?php for ($i = 0; $i < count($arrMobAllCommand); $i++) { ?>
<?php if ($arrMobAllCommand[$i]['Pnamevs'] != "") { ?>
<center>
<?= $arrMobAllCommand[$i]['Pvsname'] != "" && $arrMobAllCommand[0]['command'] < 2 ? $arrCommandIco[$arrUserAllCommand[0]['command']] : ""; ?>
<?= $arrMobAllCommand[$i]['Pnamevs']; ?>
<?= $arrMobAllCommand[$i]['Pvsname'] != "" ? " vs " : ""; ?>
<?= $arrMobAllCommand[$i]['Pvsname'] != "" && $arrUserAllCommand[0]['command'] < 2 ? $arrCommandIco[$arrUserAllCommand[0]['command']] : ""; ?>
<?= $arrMobAllCommand[$i]['Pvsname']; ?>
</center>
<?php } ?>
<?php } ?>
<script>MyLib.footName = "command";</script>
<hr style="background-color: #e7cd96">
<?php
if($arr1['Pnamevs']=="выживание"){
echo_vjv($arr2);
}else if($arr1['Pnamevs']=="Отбор (Земля)"){
echo_vjv($arr2);
}else if($arr1['Pnamevs']=="Земля"){
echo_zemlya($arrUserAllCommand);
echo_zemlya($arrMobAllCommand);
}else if ($arrUserAllCommand[0]['command'] == 1 && $arrMobAllCommand[0]['command'] == 0) {
echo_command($arrUserAllCommand);
echo_command($arrMobAllCommand);
} else if ($arrUserAllCommand[0]['command'] == 1 && $arrMobAllCommand[0]['command'] == 2) {
echo_command($arrUserAllCommand);
echo_command($arrMobAllCommand);
} else if ($arrUserAllCommand[0]['command'] == 2 && $arrMobAllCommand[0]['command'] == 0) {
echo_command($arrUserAllCommand);
echo_command($arrMobAllCommand);
} else if ($arrUserAllCommand[0]['command'] == 2 && $arrMobAllCommand[0]['command'] == 1) {
echo_command($arrUserAllCommand);
echo_command($arrMobAllCommand);
} else if ($arrUserAllCommand[0]['command'] == 0 && $arrMobAllCommand[0]['command'] == 1) {
echo_command($arrUserAllCommand);
echo_command($arrMobAllCommand);
} else if ($arrUserAllCommand[0]['command'] == 0 && $arrMobAllCommand[0]['command'] == 2) {
echo_command($arrUserAllCommand);
echo_command($arrMobAllCommand);
}
$footval = 'command';
require_once ('../system/foot/foot.php');
} else {
?>
<script>showContent("/main.php");</script>
<?php
exit(0);
}
} else {
?>
<script>showContent("/main.php");</script>
<?php
exit(0);
}
function echo_command($allCommand) {
global $arrCommandIco;
global $arrCommand;
global $user;
?>
<center><?php echo $arrCommandIco[$allCommand[0]['command']] . " " . $arrCommand[$allCommand[0]['command']]; ?></center>
<table class="table_block2">
<?php
for ($i = 0; $i < count($allCommand); $i++) {
?>
<?php if ($allCommand[$i]['Mid'] == $user['id']) { ?>
<tr>
<td style="width: 70%"><b><?= $allCommand[$i]['Pname']; ?>[<?= $allCommand[$i]['level']; ?>]</b></td>
<?php if ($allCommand[$i]['Plife'] <= 0) { ?>
<td style="width: 30%"><b>Убит</b></td>
<?php } else { ?>
<td style="width: 30%"><b><?= $allCommand[$i]['Plife']; ?></b></td>
<?php } ?>
</tr>
<?php } else { ?>
<tr>
<td style="width: 70%"><?= $allCommand[$i]['Pname']; ?>[<?= $allCommand[$i]['level']; ?>]</td>
<?php if ($allCommand[$i]['Plife'] <= 0) { ?>
<td style="width: 30%">Убит</td>
<?php } else { ?>
<td style="width: 30%"><?= $allCommand[$i]['Plife']; ?></td>
<?php } ?>
</tr>
<?php } ?>
<?php } ?>
</table>
<hr style="background-color: #e7cd96">
<?php
}
function echo_vjv($allCommand) {
global $user;
?>
<table class="table_block2">
<?php
for ($i = 0; $i < count($allCommand); $i++) {
?>
<?php if ($allCommand[$i]['Mid'] == $user['id']) { ?>
<tr>
<td style="width: 70%"><b><?= $allCommand[$i]['Pname']; ?>[<?= $allCommand[$i]['level']; ?>]</b></td>
<?php if ($allCommand[$i]['Plife'] <= 0) { ?>
<td style="width: 30%"><b>Убит</b></td>
<?php } else { ?>
<td style="width: 30%"><b><?= $allCommand[$i]['Plife']; ?></b></td>
<?php } ?>
</tr>
<?php } else { ?>
<tr>
<td style="width: 70%"><?= $allCommand[$i]['Pname']; ?>[<?= $allCommand[$i]['level']; ?>]</td>
<?php if ($allCommand[$i]['Plife'] <= 0) { ?>
<td style="width: 30%">Убит</td>
<?php } else { ?>
<td style="width: 30%"><?= $allCommand[$i]['Plife']; ?></td>
<?php } ?>
</tr>
<?php } ?>
<?php } ?>
</table>
<hr style="background-color: #e7cd96">
<?php
}
function echo_zemlya($allCommand) {
global $arrCommandIco;
global $arrCommand;
global $user;
global $mc;
$nameclan = $mc->query("SELECT `name` FROM `clan` WHERE `id` = ". $allCommand[0]['command'] ."")->fetch_array(MYSQLI_ASSOC);
?>
<center><?php echo $nameclan["name"]; ?></center>
<table class="table_block2">
<?php
for ($i = 0; $i < count($allCommand); $i++) {
?>
<?php if ($allCommand[$i]['Mid'] == $user['id']) { ?>
<tr>
<td style="width: 70%"><b><?= $allCommand[$i]['Pname']; ?>[<?= $allCommand[$i]['level']; ?>]</b></td>
<?php if ($allCommand[$i]['Plife'] <= 0) { ?>
<td style="width: 30%"><b>Убит</b></td>
<?php } else { ?>
<td style="width: 30%"><b><?= $allCommand[$i]['Plife']; ?></b></td>
<?php } ?>
</tr>
<?php } else { ?>
<tr>
<td style="width: 70%"><?= $allCommand[$i]['Pname']; ?>[<?= $allCommand[$i]['level']; ?>]</td>
<?php if ($allCommand[$i]['Plife'] <= 0) { ?>
<td style="width: 30%">Убит</td>
<?php } else { ?>
<td style="width: 30%"><?= $allCommand[$i]['Plife']; ?></td>
<?php } ?>
</tr>
<?php } ?>
<?php } ?>
</table>
<hr style="background-color: #e7cd96">
<?php
}