';
if($enemy == 0){
// проверяем на вшивость
if(!$fbattle->battle) {
if($user['battle']) { $ll = $user['battle'];} else { $ll = $_POST['batl']; }
if(!$ll)
{
$ll_r=mysql_fetch_array(mysql_query("SELECT `id` FROM `battle` WHERE (`t1` LIKE '%{$user['id']}%' || `t2` LIKE '%{$user['id']}%') AND `win` = '3' LIMIT 1"));
$ll=$ll_r['id'];
}
$data = @mysql_fetch_array(mysql_query("SELECT * FROM `battle` WHERE `id` = {$ll} LIMIT 1"));
$damage = unserialize($data['damage']);
$exp = unserialize($data['exp']);
if(empty($damage[$user['id']])) { $damage[$user['id']] = 0; }
if($user['caveleader'] > 0 || $user['laba'] > 0) {
$rep = floor($damage[$user['id']]/300);
if($rep <= 0) {
$rep = 0;
}
$ads = '. Репутации: '.$rep.' ед.';
} else {
$rep = 0;
$ads = '.';
}
echo '
Бой закончен! Всего вами нанесено урона '.$damage[$user['id']].' HP. Получено опыта '.(int)$exp[$user['id']].' ('.check_proc($user['id']).'%)'.$ads.'
';
}
} else {
?>
}
if($fbattle->battle) {
?>
foreach($fbattle->t1 as $k => $v) {
if(in_array($v, array_keys($fbattle->battle))) {
++$i;
if($i > 1) { $cc = ', '; } else { $cc = ''; }
$ffs .= $cc.nick4($v, "B1");
$zz .= "private [".nick7($v)."] ";
}
}
$i = 0;
?>
=$ffs?>
против
$ffs = ''; $zz = '';
foreach($fbattle->t2 as $k => $v) {
if(in_array($v, array_keys($fbattle->battle))) {
++$i;
if($i > 1) { $cc = ', '; } else { $cc = ''; }
$ffs .= $cc.nick4($v, "B2");
$zz .= "private [".nick7($v)."] ";
}
}
$i = 0;
?>
=$ffs?>
На данный момент вами нанесено урона:
=(int)$fbattle->damage[$user['id']]?> HP.
if(!$user['in_tower']) { ?>
(Бой идет с таймаутом =$fbattle->battle_data['timeout']?> мин.)
} ?>
} else {
echo "
";
}
if($user['battle']) { $ll = $user['battle']; } elseif($_REQUEST['batl']) { $ll = $_REQUEST['batl']; } else { $ll = $_SESSION['batl']; }
if(!$ll) {
$ll_r = mysql_fetch_array(mysql_query("SELECT `id` FROM `battle` WHERE (`t1` LIKE '%{$user['id']}%' OR `t2` LIKE '%{$user['id']}%') AND `win` = 3 LIMIT 1"));
$ll = $ll_r['id'];
}
$fs = filesize("backup/logs/battle".$ll.".txt");
$fh = fopen("backup/logs/battle".$ll.".txt", "r");
fseek($fh, -4256, SEEK_END);
$log[0] = fread($fh, 4256);
fclose($fh);
$log = explode("
", $log[0]);
$ic = count($log)-2;
if($fs >= 4256) {
$max = 1;
} else {
$max = 0;
}
for($i = $ic; $i >= 0+$max; --$i) {
if(eregi("
", $log[$i])) {
$log[$i] = str_replace("
", "", $log[$i]);
$log[$i] = $log[$i]."
";
}
if(eregi(">".$user['login']."", $log[$i])) {
$log[$i] = str_replace("", "", $log[$i]);
}
if($ll != 0) {
if(eregi("
", $log[$i])) {
echo $log[$i];
} else {
echo $log[$i]."
";
}
}
}
unset($ic);
if($max == 1) {
?>
Полную версию лога боя, смотрите здесь»
} ?>
if($fbattle->return == 1) {
echo showinf_pers($fbattle->enemy, 1, 1);
} else {
if($fbattle->battle_data['type'] == 4 || $fbattle->battle_data['type'] == 5) {
$a = array(6, 16);
echo "";
} elseif($fbattle->return > 1) {
echo "";
} elseif($exp[$user['id']] > 0) {
echo "";
} else {
echo "";
}
}
if($fbattle->needrefresh) {
header("Location: fbattle.php?".time());
}
if($fbattle->battle_data['needbb']) {
foreach($fbattle->battle as $k => $v) {
if($k > _BOTSEPARATOR_) {
foreach($v as $k2 => $v2) {
if($k2 < _BOTSEPARATOR_) continue;
$hp_1 = mysql_fetch_array(mysql_query('SELECT `hp` FROM `bots` WHERE `id` = "'.$k.'" LIMIT 1'));
$hp_2 = mysql_fetch_array(mysql_query('SELECT `hp` FROM `bots` WHERE `id` = "'.$k2.'" LIMIT 1'));
if($fbattle->battle[$k][$k2][0] && $fbattle->battle[$k2][$k][0] && $hp_1['hp'] > 0 && $hp_2['hp'] > 0 && time()-$fbattle->battle[$k][$k2][2] > 1 && time()-$fbattle->battle[$k2][$k][2] > 1) {
$at_1 = $fbattle->battle[$k][$k2][0];
$def_1 = $fbattle->battle[$k][$k2][1];
$at_2 = $fbattle->battle[$k2][$k][0];
$def_2 = $fbattle->battle[$k2][$k][1];
$fbattle->makechange($k, $k2, $at_1, $at_2, $def_1, $def_2);
$fbattle->write_log();
$fbattle->battle[$k][$k2] = array(0, 0, time());
$fbattle->battle[$k2][$k] = array(0, 0, time());
$fbattle->needupdate = 1;
}
}
}
}
if($fbattle->needupdate) {
$fbattle->UpdateBattle();
}
}
?>
|
|