Файл: monst/core/jphp/d/attack.php
Строк: 81
<?
$HOME = $_SERVER['DOCUMENT_ROOT'];
include $HOME . '/core/in/j.php';
$dungeon_id = (int)$_POST['dungeon_id'];
$d = $_d -> findOne(
[
'dungeon_id' => $dungeon_id,
'group_id' => $GROUP['id']
]
);
if ( !$d ) {
exit;
}
include $HOME . '/core/content/dungeon.php';
if ( !$monster = $DUNGEON[$d['dungeon_id']]['data'][$d['monster_id']] ) {
exit;
}
if ( $d['monster_hp'] <= 0 ) {
exit;
}
$log = '';
$damage = $user['st'];
//
$damage -= $monster['armor'];
if ( $damage < 0 ) $damage = 0;
$monster_newhp = $d['monster_hp'] - $damage;
$monsterhp_percent = round($monster_newhp / $d['monster_hpf'] * 100);
$log = Name($user['id']).' > <img src="/core/i/dungeon/monster/'.$d['dungeon_id'].'/'.$d['monster_id'].'.jpg" alt="" width="15"/> '.$monster['name'].': <span style="color: indianred;">'.$damage.'</span><br/>' . $log;
$m_damage = $monster['st'];
$m_damage -= $user['armor'];
if ($m_damage < 0) $m_damage = 0;
$user_newhp = $user['hp'] - $m_damage;
$log = '<img src="/core/i/dungeon/monster/' . $d['dungeon_id'] . '/' . $d['monster_id'] . '.jpg" alt="" width="15"/> ' . $monster['name'] . ' > <img src="'.av($user['id']).'" alt="" width="15"/>' . Name($user['id']) . ': <span style="color: indianred;">' . $m_damage . '</span><br/>' . $log;
$log = '<span style="color: #777;">' . date('H:i:s') . '</span><br/>' . $log;
$log = $log . '--<br/>' . $d['log'];
// clear log
$new_log = '';
$log_array = explode('<br/>', $log);
$i = 0;
foreach ( $log_array as $log_line ) {
$new_log .= $log_line.'<br/>';
$i++;
if ( $i >= 11 ) {
break;
}
}
$log = $new_log;
$upd = $_d -> update(
[
'id' => $d['id']
],
[
'$set' =>
[
'monster_hp' => $monster_newhp,
'log' => $log
]
]
);
$upd = $_users->update(
[
'id' => $user['id']
],
[
'$set' =>
[
'hp' => $user_newhp,
]
]
);
if ( $user_newhp <= 0 ) {
$_users -> update(
[
'id' => $user['id']
],
[
'$set' => [
'dead_time' => time() + 10
]
]
);
$log = '';
$log = '<img src="'.av($user['id']).'" alt="" width="15"/>'.Name($user['id']).' <span style="color: indianred;">' . $lang['dungeon']['dead'] . '</span><br/>' . $log;
$log = '<span style="color: #777;">' . date('H:i:s') . '</span><br/>' . $log;
$log = $log . '--<br/>' . $d['log'];
$upd = $_d -> update(
[
'id' => $d['id']
],
[
'$set' =>
[
'log' => $log
]
]
);
}