Вход Регистрация
Файл: monst/core/file/ca.php
Строк: 94
<?
include_once $HOME . '/core/content/monster.php';
include_once 
$HOME . '/core/content/dungeon.php';

// city attack
$ca_timer = (int)file_get_contents($HOME . '/core/data/ca_timer.dat');
if ( 
$ca_timer == 0 OR ($ca_timer > 0 AND $ca_timer < time()) ) {
    function 
random_monster() {
        global 
$HOME, $lang, $MONSTER, $DUNGEON;


        
$rnd = rand(1, 2);

        
$m = [];

        if ( 
$rnd == 1 ) {
//        $part = rand(1, count($MONSTER));
            
$part = rand(1, 2);

            
$count = 0;
            foreach ( 
$MONSTER[$part] as $monster_id => $monster_array ) {
                if ( !
$monster_array['boss'] ) {
                    
$count = $monster_id;
                }
            }

            
$m_id = rand(1, $count);

            
$m['icon'] = '/core/i/monster/'.$part.'/'.$m_id.'.jpg';
            
$m['name'] = $MONSTER[$part][$m_id]['name'];
            
$m['st'] = $MONSTER[$part][$m_id]['st'];
            
$m['hp'] = $MONSTER[$part][$m_id]['hp'];
            
$m['armor'] = $MONSTER[$part][$m_id]['armor'];

        } elseif ( 
$rnd == 2 ) {
//        $dungeon_id = rand(1, count($DUNGEON));
            
$dungeon_id = 1;


            
$count = 0;
            foreach ( 
$DUNGEON[$dungeon_id]['data'] as $monster_id => $monster_array ) {
                if ( !
$monster_array['boss'] ) {
                    
$count = $monster_id;
                }
            }

            
$m_id = rand(1, $count);

            
$m['icon'] = '/core/i/dungeon/monster/'.$dungeon_id.'/'.$m_id.'.jpg';
            
$m['name'] = $DUNGEON[$dungeon_id]['data'][$m_id]['name'];
            
$m['st'] = $DUNGEON[$dungeon_id]['data'][$m_id]['st'];
            
$m['hp'] = $DUNGEON[$dungeon_id]['data'][$m_id]['hp'];
            
$m['armor'] = 0;


        }

        return 
$m;
    }


    
$m = random_monster();

    
$_ca -> remove();

//    $find = $_users -> find(
//        [
//            'l_time' => [
//                '$gte' => time() - 60 * 60
//            ],
//        ]
//    );
//
//    $online = $find -> count();

    
$rnd = rand(1, 2);

    if ( 
$rnd == 1 ) {
        
$count = 7000;
    } else {
        
$count = 15000;
    }

    
$_ca -> insert(
        [
            
'id' => 1,
            
'hp' => $m['hp'],
            
'm' => $m,
//            'count' => $online * 100,
//            'count' => 1,
            
'count' => $count,
            
'user_ids' => [],
            
'log' => '',
            
'uniq_id' => rand(1000000, 9999999) . rand(1000000, 9999999),
        ]
    );

    
$fp = fopen($HOME . '/core/data/ca_timer.dat', 'w+');
    
fwrite($fp, '-1');
    
fclose($fp);

}
Онлайн: 3
Реклама