Файл: monst/core/jphp/fig/index.php
Строк: 213
<?
$HOME = $_SERVER['DOCUMENT_ROOT'];
include $HOME . '/core/in/j.php';
//include $HOME . '/core/lang/' . $user['lang'] . '/fig.php';
//include $HOME . '/core/file/a.php';
$fig = $_fig -> findOne(
[
'user_id' => $user['id']
]
);
if ( !$fig ) {
?>
<script>
window.location = '/campaign';
</script>
<?
exit;
}
include $HOME . '/core/content/monster.php';
if ( !$monster_dat = $MONSTER[$user['part']][$fig['monster_id']] ) {
exit;
}
//$fig['monster_hp'] = 0;
//
if ( $fig['monster_hp'] <= 0 OR $user['hp'] <= 0 ) {
?>
<script>
$('#monster_img').hide();
$('#monster_img_gray').show();
</script>
<?
}
if ( $fig['monster_hp'] <= 0 ) {
// user win
$gold = $monster_dat['gold'];
$silver = $monster_dat['silver'];
$exp = $monster_dat['exp'];
if ( $user['vip_time'] > time() ) {
$gold = $gold * 2;
$silver = $silver * 2;
}
// quest
foreach ( $quest as $q ) {
if ( $q['type'] == 'kill_monster' ) {
if ( $fig['monster_id'] == $q['uniq_id'] ) {
$quest_db[$q['id']]['count'] = 1;
}
}
}
//
$_fig -> remove(
[
'user_id' => $user['id']
]
);
$_users -> update(
[
'id' => $user['id']
],
[
'$set' => [
'gold' => $user['gold'] + $gold,
'silver' => $user['silver'] + $silver,
'exp' => $user['exp'] + $exp,
'hp' => $user['hpf'],
'fig' => $user['fig'] - 1,
'next_fig_time' => time() + 60 * 60 * 2,
'last_monster_id' => $user['last_monster_id'] + 1,
'quest' => $quest_db
]
]
);
?>
<script>
$('#effect_killed').show();
$('#monster_img').css('filter', 'grayscale(100%)');
$('#monster_img').css('-webkit-filter', 'grayscale(100%)');
</script>
<br/>
<div>
<div style='text-align: center;'>
<span style='font-size: 30px; color: yellowgreen;'>
<?=$lang['fig']['win']?>
</span>
<br/>
<span style='color: #ccc; font-size: 17px;'><?=$lang['fig']['reward']?></span>
<br/>
<img src='<?=$gold_icon?>' alt='' width='50'/><span class='gold_color'><?=num($gold)?></span>
<img src='<?=$silver_icon?>' alt='' width='50'/><span class='silver_color'><?=num($silver)?></span>
<img src='<?=$exp_icon?>' alt='' width='50'/><span class='exp_color'><?=num($exp)?></span>
<!-- <br/>-->
<!---->
<!-- <img src='/core/i/monster/--><?//=$user['part']?><!--/--><?//=$fig['monster_id']?><!--.jpg' alt='' class='monster_img' style='width: 100px; box-shadow: 0 0 0 0; filter: grayscale(100%); -webkit-filter: grayscale(100%);'/>-->
</div>
<br/><br/>
<a href='/campaign?#monster'><div class='bt_black' style='text-align: center;'><?=$lang['fig']['continue']?></div></a>
</div>
<?
} elseif ( $user['hp'] <= 0 ) {
// user lose
$no_gold = 0;
if ( $user['lastmonsterid_fail_gold'] == $fig['monster_id'] ) {
$gold = 0;
$silver = 0;
$exp = 0;
$no_gold = 1;
} else {
$gold = round($monster_dat['gold'] / 2);
$silver = round($monster_dat['silver'] / 2);
$exp = round($monster_dat['exp'] / 2);
if ( $user['vip_time'] > time() ) {
$gold = $gold * 2;
$silver = $silver * 2;
$exp = $exp * 2;
}
}
$_fig -> remove(
[
'user_id' => $user['id']
]
);
$_users -> update(
[
'id' => $user['id']
],
[
'$set' => [
'gold' => $user['gold'] + $gold,
'silver' => $user['silver'] + $silver,
'exp' => $user['exp'] + $exp,
'hp' => $user['hpf'],
'fig' => $user['fig'] - 1,
'next_fig_time' => time() + 60 * 60 * 2,
'lastmonsterid_fail_gold' => $fig['monster_id']
]
]
);
?>
<br/>
<div>
<div style='text-align: center;'>
<span style='font-size: 30px; color: indianred;'>
<?=$lang['fig']['lose']?>
</span>
<br/>
<?
if ( !$no_gold ) {
?>
<span style='color: #ccc; font-size: 17px;'><?=$lang['fig']['lose_get']?></span>
<br/>
<img src='<?=$gold_icon?>' alt='' width='50'/><span class='gold_color'><?=num($gold)?></span>
<img src='<?=$silver_icon?>' alt='' width='50'/><span class='silver_color'><?=num($silver)?></span>
<img src='<?=$exp_icon?>' alt='' width='50'/><span class='exp_color'><?=num($exp)?></span>
<?
}
?>
<br/>
<?
if ( $user['part'] == 1 ) {
print $lang['fig']['lose_help_1'].'<br/>';
} else {
print $lang['fig']['lose_help'].'<br/>';
}
?>
</div>
<br/><br/>
<a href='/campaign?#monster'><div class='bt_black' style='text-align: center;'><?=$lang['fig']['continue']?></div></a>
</div>
<?
}
//
if ( $fig['monster_hp'] > 0 AND $user['hp'] > 0 ) {
$monsterhp_percent = round($fig['monster_hp'] / $fig['monster_hpf'] * 100);
if ($monsterhp_percent < 0) $monsterhp_percent = 0;
?>
<div style='background: #000;'>
<div style='display: inline-block;'>
<img src='/core/i/monster/<?= $user['part'] ?>/<?= $fig['monster_id'] ?>.jpg' alt='' width='50'/>
</div>
<div style='display: inline-block; text-align: left; vertical-align: bottom; padding: 5px;'>
<span style='color: #999;'><?= $monster_dat['name'] ?></span> <? if ( $monster_dat['boss'] ) print '<span class="boss">Босс</span>'; ?>
<div>
<img src='/core/i/user/hp.png?3' alt='' width='10'/><span class='hp_color'
style='font-size: 11px;'><?= num($fig['monster_hp']) ?></span>
<img src='/core/i/user/st.png?2' alt='' width='10'/><span class='st_color'
style='font-size: 11px;'><?= num($monster_dat['st']) ?></span>
<img src='/core/i/user/armor.png?2' alt='' width='10'/><span class='armor_color'
style='font-size: 11px;'><?= num($monster_dat['armor']) ?></span>
</div>
<div style='background: #222; width: 200px; height: 15px; margin: auto; margin: 2px;'>
<div style='background: indianred; width: <?= $monsterhp_percent ?>%; height: 15px;'></div>
</div>
</div>
</div>
<?
$userhp_percent = round($user['hp'] / $user['hpf'] * 100);
if ($userhp_percent < 0) $userhp_percent = 0;
?>
<div>
<div style='background: #000; text-align: center;'>
<div>
<div style='display: inline-block; vertical-align: bottom;'>
<img src='/core/i/user/no_av.jpg' alt='' width='50'/>
</div>
<div style='display: inline-block; text-align: left; vertical-align: top; padding: 5px;'>
<span style='color: #999;'><?= Name($user['id']) ?></span>
<div>
<img src='/core/i/user/hp.png?3' alt='' width='10'/><span class='hp_color'
style='font-size: 11px;'><?= num($user['hp']) ?></span>
<img src='/core/i/user/st.png?2' alt='' width='10'/><span class='st_color'
style='font-size: 11px;'><?= $user['st'] ?></span>
<img src='/core/i/user/armor.png?2' alt='' width='10'/><span class='armor_color'
style='font-size: 11px;'><?= $user['armor'] ?></span>
</div>
<div style='background: #222; width: 200px; height: 15px; margin: auto; margin: 2px;'>
<div style='background: steelblue; width: <?= $userhp_percent ?>%; height: 15px;'></div>
</div>
</div>
</div>
</div>
</div>
<?
$logs = '';
$log_array = explode('<br/>', $fig['log']);
for ( $i = 0; $i < 7; $i++) {
if ( isset($log_array[$i]) ) {
$logs .= $log_array[$i].'<br/>';
}
}
?>
<br/>
<div style='text-align: center; margin:auto;max-width: 300px; col2or: #5a6879; font-size: 12px;'>
<?=$logs?>
</div>
<?
}
?>