Файл: public_html/modules/locations/battle.php
Строк: 104
<?php
include_once ($_SERVER['DOCUMENT_ROOT'].'/core/base.php');
falseauth();
$header = "Окрестности";
include_once ($_SERVER['DOCUMENT_ROOT'].'/core/head.php');
$location_id = fl($_GET['id']);
$btl = $db->query("SELECT * FROM `locations_battles` WHERE `user` = '".$u['id']."'");
if($btl->num_rows == 0) redirect('/locations');
$btl = $btl->fetch_object();
$mob = $db->query("SELECT * FROM `locations_mobs` WHERE `id` = '".$btl->mob."'")->fetch_object();
$myHealthProgress = round(($btl->my_health*100)/get_max_health($btl->user));
$mobHealthProgress = round(($btl->mob_health*100)/$mob->health);
locationResult($btl->id, $location_id, $mob->name);
$logBattleLocations = $memcache->get('log_'.$u['id'].''); // log memcache
$timeDMG = time() - $btl->times; // Setting time global battle
if(isset($_GET['attack']))
{
$myDamage = getDamage(get_power($u['id']), $mob->block);
$mobDamage = getDamage($mob->power, get_block($u['id']));
/*
*
Слишком частые удары блокируем
*
*/
if($timeDMG < 2) $myDamage = ceil($myDamage / 4);
/*
*
Если игрок филонит то бьём его на максимум
*
*/
if((time() - $btl->times) > 14) {
$mobDamage += ceil(($timeDMG / 5) * 2);
}
$db->query("UPDATE `locations_battles` SET `my_health` = `my_health` - '".$mobDamage."', `mob_health` = `mob_health` - '".$myDamage."', `times` = '".time()."' WHERE `id` = '".$btl->id."'");
// Create set log
array_unshift($logBattleLocations, 'Вы нанесли '.$mob->name.' '.$myDamage.' урона.');
array_unshift($logBattleLocations, ''.$mob->name.' нанёс вам '.$mobDamage.' урона.');
$memcache->set('log_'.$u['id'].'', $logBattleLocations, false, 366400);
$_SESSION['my_dmg'] = ceil($myDamage);
$_SESSION['opp_dmg'] = ceil($mobDamage);
redirect('/locations/'.$location_id.'/battle');
}
/*
*/
?>
<style>
.progress-red {
background: #B22222;
height: 10px;
float: right;
}
</style>
<div class = "b"><table width="100%" border="0" cellpadding="0" cellspacing="0"><tr><td width="38%" align="right" valign="top">
<center><big><font color = 'lime'>Вы</font></big>
<div style='height: 10px; border: 1px solid #000; background: #171410; position:relative; border-radius: 2px'>
<div style='height: 10px;background: #ee9200; width:<?=$myHealthProgress;?>%; max-width:100%;position: absolute; left: 0px; top: 0px; border-radius: 2px; border-bottom-right-radius: 1px;border-top-right-radius: 1px;'>
<?
/*
// Шкала удара бота игроку
if($_SESSION['opp_dmg'] > 0) {
?>
<div class="progress-red" style="width:<?=round(100/(get_max_health($btl->user)/$_SESSION['opp_dmg']));?>%;"></div>
<?
unset($_SESSION['opp_dmg']);
}
*/
?>
</div>
</div>
</br>
</center></a><br><img src='/images/battleground/<?=$u['sex'];?>.png' width='100' height='100
' style='margin-right:3px;margin-top:-25px;'></a>
<td width='50%'>
<table width='80%' height='80%' border='0' cellpadding='0' cellspacing='0' align='center'><br> </br>
<tbody><tr align='center'>
<td width='33%' class='text-right'><font color = 'white'> <?=get_power($u['id']);?></font></td>
<td> <img src='/images/str.png' width='30px'></td>
<td width='33%' class='text-left'><font color = 'white'><?=$mob->power;?></font></td></tr>
<tr align='center'><td width='33%' class='text-right'><font color = 'white'><?=get_block($u['id']);?></font></td>
<td width='15'> <img src='/images/def.png' width='30px'></td>
<td width='33%' class='text-left'><font color = 'white'><?=$mob->block;?></font></td></tr>
<tr align='center'>
<td width='33%'><font color = 'white'><?=get_max_health($u['id']);?></td>
<td><img src='/images/health.png' width='30px'></td>
<td width='33%' class='text-left'><font color = 'white'><?=$mob->health;?></font></td>
</tr>
</font>
</tbody>
</table>
</div></td>
<td width='38%' align='left' valign='top'>
<center> <big><font color = 'red'><?=$mob->name;?></font></big>
<div style='height: 10px; border: 1px solid #000; background: #171410; position:relative; border-radius: 2px'>
<div style='height: 10px;background: #ee9200; width:<?=$mobHealthProgress;?>%; max-width:100%; position: absolute; left: 0px; top: 0px; border-radius: 2px; border-bottom-right-radius: 1px;border-top-right-radius: 1px;'>
<?
// Шкала удара игрока боту
/*
if($_SESSION['my_dmg'] > 0) {
?>
<div class="progress-red" style="width:<?=round(100/($mob->health/$_SESSION['my_dmg']));?>%;"></div>
<?
unset($_SESSION['my_dmg']);
}
*/
?>
</div>
</div>
</br>
</center></a><br><img src='/images/ico_monster/<?=$mob->id;?>.png' width='100' height='100' style='margin-right:3px;margin-top:-25px;'></td></tr></table>
<center><a href ='/locations/<?=$location_id;?>/battle/attack'> <img src='/images/battleground/attack.png'></a></center>
</div>
<!-- log battle new success -->
<?
if (count($logBattleLocations) > 0) {
foreach(array_slice($logBattleLocations, 0, 6, true) as $key) {
?>
<div class = "notice_container">
<div class = "gborder notice_alert alert-success">
<?=$key;?>
</div></div>
<?
}
}
?>
<?
include_once ($_SERVER['DOCUMENT_ROOT'].'/core/foot.php');
?>