Вход Регистрация
Файл: monst/core/jphp/d/index.php
Строк: 364
<?
$HOME 
$_SERVER['DOCUMENT_ROOT'];

include 
$HOME '/core/in/j.php';


//$_d -> remove();

$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 ( isset($user['dungeon_cooldown'][$d['dungeon_id']]) AND $user['dungeon_cooldown'][$d['dungeon_id']] > time () ) {
////    ?>
<!--<!--    <script>-->-->
<!--<!--        window.location = '/dungeon?id=-->--><?////=$d['dungeon_id']?><!--//&user_limit';-->
<!--//    </script>-->
<!--//    --><?////
////    exit;
////}
*/

if ( $user['hp'] <= ) {
//    $_users->update(
//        [
//            'id' => $user['id']
//        ],
//
//        [
//            '$set' => [
//                'hp' => $user['hpf']
//            ]
//        ]
//    );
//
//    g('/d/'.$d['dungeon_id']);

    
?>
    <script>
        $('#monster_img').hide();
        $('#monster_img2').show();

        function timer() {
            $.ajax({
                type: "POST",
                url: "/core/jphp/d/timer.php",
                data: "dungeon_id=<?=$d['dungeon_id']?>",

                success: function (timer) {
//                    alert(timer);
                    if ( timer === '1' ) {
                        window.location = '/d/<?=$d['dungeon_id']?>';
                    } else {
                        $('#timer').empty();
                        $('#timer').append(timer);

                    }

                }
            });

        }

        timer();
        setInterval(timer, 1000);

    </script>

    <div style='height: 0;'>

        <div style='z-index: 9999999;position: relative; top: 200px; background: #000; padding: 20px;'>
            Вас убили.<br/>
            <br/>
            <span id='timer'></span>
        </div>

        <script>
            clearInterval(indexInterval);
        </script>

    </div>

    <?

} else {

    if (
$d['monster_hp'] <= 0) {

        if (
$d['monster_count'] - <= 0) { // меняем монстра
            
if (!isset($DUNGEON[$d['dungeon_id']]['data'][$d['monster_id'] + 1])) { // подземелье пройдено
                
?>
                <script>
                    clearInterval(indexInterval);
                </script>


                <?
                $dd 
$DUNGEON[$d['dungeon_id']];

                
$gold $dd['gold'];
                
$silver $dd['silver'];
                
$exp $dd['exp'];

                if ( 
$user['vip_time'] > time() ) {
                    
$gold $gold 2;
                    
$silver $silver 2;
                    
$exp $exp 2;

                }

//                if ( $user['dungeon_goldlimit_count'] > 300 ) {
//                    $gold = 0;
//                }

                
if (!isset($d['reward_data'][$user['id']])) {


                            foreach ( 
$quest as $q ) {
                                if ( 
$q['type'] == 'dungeon_gold' ) {
                                    
$quest_db[$q['id']]['count'] += $gold;
                                }
                            }

                    foreach ( 
$daily as $q ) {
                        if ( 
$q['type'] == 'dungeon_gold' ) {
                            
$daily_db[$q['id']]['count'] += $gold;
                        }
                    }


                    
$_users->update(
                                [
                                    
'id' => $user['id']
                                ],

                                [
                                    
'$set' => [
                                        
'gold' => $user['gold'] + $gold,
                                        
'silver' => $user['silver'] + $silver,
                                        
'exp' => $user['exp'] + $exp,
                                        
'dungeon_count' => $user['dungeon_count'] + 1,
                                        
'dungeon_cooldown.' $d['dungeon_id'] => $dd['cooldown'],
                                        
'quest' => $quest_db,
                                        
'daily' => $daily_db,
                                        
'dungeon_goldlimit_count' => $user['dungeon_goldlimit_count'] + $gold,
                                    ]
                                ]
                            );


                            
$text $dd['name'] . ' - ' $lang['dungeon']['d_finish'] . '<br/>

                            <img src="' 
$gold_icon '" alt="" width="40"/><span class="gold_color">' num($dd['gold']) . '</span>
                            <img src="' 
$silver_icon '" alt="" width="40"/><span class="gold_color">' num($dd['silver']) . '</span>
                            <img src="' 
$exp_icon '" alt="" width="40"/><span class="gold_color">' num($dd['exp']) . '</span>
                            
                            '
;


//                            $id = new_id('_not');
//                            $_not -> insert(
//                                [
//                                    'id' => $id,
//                                    'user_id' => $user_id,
//                                    'time' => time(),
//                                    'text' => $text
//                                ]
//                            );




                    
$_group->update(
                        [
                            
'id' => $GROUP['id']
                        ],

                        [
                            
'$set' => [
                                
'dungeon_count' => $GROUP['dungeon_count'] + 1,
                                
'dungeon_cooldown.' $d['dungeon_id'] => $dd['cooldown'],
                            ]
                        ]
                    );

                    
$_d->update(
                        [
                            
'id' => $d['id']
                        ],

                        [
                            
'$set' => [
                                
'reward_data.' $user['id'] => 1
                            
]
                        ]
                    );

//                    echo 'dddddddddddddddddddddddddd2<br/>';

                
} else {
  
//                  echo 'dddddddddddddddddddddddddd1<br/>';
                    
if ($GROUP['dungeon_cooldown'][$d['dungeon_id']] < time()) {

                        
$_d->remove(
                            [
                                
'id' => $d['id']
                            ]
                        );
                    }

//                    g('/d');
                
}

                
?>
                <script>
                    $('#monster_panel').hide();
                    $('#user_panel').hide();
                    $('#monster_count').hide();

                    $('#monster_img').hide();
                    $('#monster_img2').show();
                </script>


                <div style='height: 0;'>

                    <div style='position: relative; top: 100px; background: #000; padding: 30px; z-index: 20000;'>
                        <span style='color: gold; font-size: 20px;'><?= $lang['dungeon']['end'?></span><br/>
                        <br/>
                        <?= $lang['dungeon']['prize'?>:<br/>
                        <img src='<?= $gold_icon ?>' alt='' width='40'/><span
                                class='gold_color'><?= num($gold?></span>
                        <img src='<?= $silver_icon ?>' alt='' width='40'/><span
                                class='silver_color'><?= num($silver?></span>
                        <img src='<?= $exp_icon ?>' alt='' width='40'/><span
                                class='exp_color'><?= num($exp?></span>

                    </div>
                </div>
                <?
            
} else { // меняем монстра
                
$m $DUNGEON[$d['dungeon_id']]['data'][$d['monster_id'] + 1];

                
$_d->update(
                    [
                        
'id' => $d['id']
                    ],

                    [
                        
'$set' => [
                            
'monster_id' => $d['monster_id'] + 1,
                            
'monster_hp' => $m['hp'],
                            
'monster_hpf' => $m['hp'],
                            
'monster_count' => $m['count']
                        ]
                    ]
                );

                
$_users->update(
                    [
                        
'id' => $user['id']
                    ],

                    [
                        
'$set' => [
                            
'hp' => $user['hpf']
                        ]
                    ]
                );


                
?>
                <script>
                    window.location = '/d/<?=$d['dungeon_id']?>';
                </script>
                <?

            
}
        } else { 
// даем нового монстра (count)

            
$log '<img src="/core/i/dungeon/monster/' $d['dungeon_id'] . '/' $d['monster_id'] . '.jpg" alt="" width="15"/> ' $monster['name'] . ' <span style="color: indianred;">' $lang['dungeon']['dead'] . '</span><br/>';

            
$log '<span style="color: #777;">' date('H:i:s') . '</span><br/>' $log;

            
$log $log '--<br/>' $d['log'];


            
$_d->update(
                [
                    
'id' => $d['id']
                ],

                [
                    
'$set' => [
                        
'monster_count' => $d['monster_count'] - 1,
                        
'monster_hp' => $monster['hp'],
                        
'monster_hpf' => $monster['hp'],
                        
'log' => $log,

                    ]
                ]
            );

            
$_users->update(
                [
                    
'id' => $user['id']
                ],

                [
                    
'$set' => [
                        
'hp' => $user['hpf']
                    ]
                ]
            );

            
?>
            <script>
                window.location = '/d/<?=$d['dungeon_id']?>';
            </script>
            <?
        
}


    }
}


?>
<div style='text-align: center;'>
    <img id='effect' src="/core/i/effect/bum.png" style='display: none; position: absolute; z-index: 1001; width: 200px;'/>

    <img OnClick='attack();' id='monster_img' src='/core/i/dungeon/monster/<?=$d['dungeon_id']?>/<?=$d['monster_id']?>.jpg?<?=filemtime($HOME '/core/i/dungeon/monster/'.$d['dungeon_id'].'/'.$d['monster_id'].'.jpg')?>' alt='' style='width: 100%; cursor: pointer;'/>

    <img id='monster_img2' src='/core/i/dungeon/monster/<?=$d['dungeon_id']?>/<?=$d['monster_id']?>.jpg?<?=filemtime($HOME '/core/i/dungeon/monster/'.$d['dungeon_id'].'/'.$d['monster_id'].'.jpg')?>' alt='' style='width: 100%; -webkit-filter: grayscale(100%); filter: grayscale(100%); display: none;'/>

</div>


<div id='monster_count' style='font-size: 50px; position: absolute; top: 150px; le2ft: 50px; margin-left: 20px; color: #ccc;'>
    <?=$d['monster_count']?>
</div>
<?


//if ( $d['monster_hp'] > 0 AND $user['hp'] > 0 ) {

    
$monsterhp_percent round($d['monster_hp'] / $d['monster_hpf'] * 100);
    if (
$monsterhp_percent 0$monsterhp_percent 0;

    
?>

    <div id='monster_panel' style='background: #000;'>
        <div style='display: inline-block;'>
            <img src='/core/i/dungeon/monster/<?=$d['dungeon_id']?>/<?=$d['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['name'?></span> <? if ( $monster['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($d['monster_hp']) ?></span>
                <img src='/core/i/user/st.png?2' alt='' width='10'/><span class='st_color'
                                                                          style='font-size: 11px;'><?= num($monster['st']) ?></span>
                <img src='/core/i/user/armor.png?2' alt='' width='10'/><span class='armor_color'
                                                                             style='font-size: 11px;'><?= num($monster['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 id='user_panel' 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>

<?
$logs 
'';

$log_array explode('<br/>'$d['log']);

for ( 
$i 0$i 11$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>

<?
//}

?>
Онлайн: 2
Реклама