Вход Регистрация
Файл: wenr.online/app/cron/bot.php
Строк: 138
<?php


    $bot 
$db->prepare('select * from `users` where `bot` != ? order by rand()');
    
$bot -> execute([0]);
    
$bot $bot -> fetch(PDO :: FETCH_OBJ);
            
### Гильдия 
            
if($bot->guild == and $bot->lvl >= 2){
                
$guild rand(1,3);
                
$arrayskin = ['','5','6','4']; 
                
$sql $db->prepare('update `users` set `guild` = ?, `skin` = ?, `max_hp` = `max_hp` + ? where `user_id` = ?');
                
$sql -> execute([$guild,$arrayskin[$guild],150,$bot->user_id]);
                }
                
                
        
### Повышение гильдии
                
if($bot->guild and $bot->lvl >= 20){
                
$arrayskin = ['','5_2','6_1','4']; 
                  
$sql $db->prepare('update `users` set `guild` = ?, `skin` = ?, `max_hp` = `max_hp` + ?, `one_handed` = ?, `two_handed` = ?, `bow` = ?, `crossbow` = ? where `user_id` = ?');
                
$sql -> execute([$bot->guild+3,$arrayskin[$bot->guild],350,100,100,100,100,$bot->guild]);
               
                     }
        
#### Заявка в клан
            
if($bot->clan == and $bot->lvl >= 10){
         
$clan $db->prepare('select * from clan order by rand()');
         
$clan -> execute();
         
$clan $clan -> fetch(PDO :: FETCH_OBJ);
         
         
#### Поверяем не отправляли ли заявку 
         
         
$check $db->prepare('select * from clan_invite where user = ?');
         
$check -> execute([$bot->user_id]);
         
$check $check -> rowCount();
         
         
                if(
$check == 0){
                    
                
### Отправляем заявку 
                
            
$inv $db->prepare('insert into clan_invite (user,clan,time) values (?,?,?)');
            
$inv -> execute([$bot->user_id,$clan->id,time()]);
               
                }
                
                     }
                     
            
            function 
rand_weapon($type){
                global 
$db,$bot;
            
$sql $db->prepare('select * from `shop` where `type` = ? order by rand()');
            
$sql -> execute([$type]);
            return 
$sql -> fetch(PDO :: FETCH_OBJ);
            }
                
                
            
#### Проверяем есть ли оружие
            
            
$check_weapon $db->prepare('select `id` from `bag` where `user` = ? and `type` = ?');
            
$check_weapon -> execute([$bot->user_id,'weapon']);
            
$check_weapon $check_weapon -> rowCount();
            
            
            if(
$check_weapon == 0){
                
            
$item rand_weapon('weapon');
           
             
$sql $db->prepare('insert into bag (`name`,`user`,`type`,`dex`,`force`,`hp`,`max_hp`,`mana`,`mana_max`,`img`,`status`) values (?,?,?,?,?,?,?,?,?,?,?)');
             
$sql -> execute([
                 
$item->name,
                 
$bot->user_id,
                 
$item->type,
                 
$item->dex,
                 
$item->force,
                 
$item->hp,
                 
$item->max_hp,
                 
$item->mana,
                 
$item->mana_max,
                 
$item->img,
                 
1
                 
]);
            }
            
            
            
            
              
            
$check_rings $db->prepare('select `id` from `bag` where `user` = ? and `type` = ?');
            
$check_rings -> execute([$bot->user_id,'rings']);
            
$check_rings $check_rings -> rowCount();
            
            
            if(
$check_rings == and $bot->lvl >= 10){
                
            
$item rand_weapon('rings');
           
             
$sql $db->prepare('insert into bag (`name`,`user`,`type`,`dex`,`force`,`hp`,`max_hp`,`mana`,`mana_max`,`img`,`status`) values (?,?,?,?,?,?,?,?,?,?,?)');
             
$sql -> execute([
                 
$item->name,
                 
$bot->user_id,
                 
$item->type,
                 
$item->dex,
                 
$item->force,
                 
$item->hp,
                 
$item->max_hp,
                 
$item->mana,
                 
$item->mana_max,
                 
$item->img,
                 
1
                 
]);
            }
            
            
            
             
$check_helm $db->prepare('select `id` from `bag` where `user` = ? and `type` = ?');
            
$check_helm -> execute([$bot->user_id,'helm']);
            
$check_helm $check_helm -> rowCount();
            
            
            if(
$check_helm == and $bot->lvl >= 15){
                
            
$item rand_weapon('helm');
           
             
$sql $db->prepare('insert into bag (`name`,`user`,`type`,`dex`,`force`,`hp`,`max_hp`,`mana`,`mana_max`,`img`,`status`) values (?,?,?,?,?,?,?,?,?,?,?)');
             
$sql -> execute([
                 
$item->name,
                 
$bot->user_id,
                 
$item->type,
                 
$item->dex,
                 
$item->force,
                 
$item->hp,
                 
$item->max_hp,
                 
$item->mana,
                 
$item->mana_max,
                 
$item->img,
                 
1
                 
]);
            }
            
            
            
            
            
             
$check_shield $db->prepare('select `id` from `bag` where `user` = ? and `type` = ?');
            
$check_shield -> execute([$bot->user_id,'shield']);
            
$check_shield $check_shield -> rowCount();
            
            
            if(
$check_shield == and $bot->lvl >= 20){
                
            
$item rand_weapon('shield');
           
             
$sql $db->prepare('insert into bag (`name`,`user`,`type`,`dex`,`force`,`hp`,`max_hp`,`mana`,`mana_max`,`img`,`status`) values (?,?,?,?,?,?,?,?,?,?,?)');
             
$sql -> execute([
                 
$item->name,
                 
$bot->user_id,
                 
$item->type,
                 
$item->dex,
                 
$item->force,
                 
$item->hp,
                 
$item->max_hp,
                 
$item->mana,
                 
$item->mana_max,
                 
$item->img,
                 
1
                 
]);
            }
            
            
            
            
            
            
            
### качаем силу и ловкость и включаем онлайн
            
$update $db->prepare('update `users` set `force` = ?, `dex` = ?, `online` = ?, `mobs` = `mobs` + ?, `exp` = ? where `user_id` = ?');
            
$update -> execute([$bot->lvl*5,$bot->lvl*3,time(),rand(10,300),$bot->exp+rand(1,1000),$bot->user_id]);
            
             if(
$bot->exp >= $bot->next_exp){
        
        
$sql $db->prepare('update `users` set `lvl` = ?, `next_exp` = ?, `max_hp` = ? where `user_id` = ?');
        
$sql -> execute([$bot->lvl+1,
                        
next_exp($bot->lvl,$bot->next_exp),
                        
$bot->max_hp+10,
                        
$bot->user_id
                        
]);
    }
    
    
            if(
$bot->clan != 0){
                
                
                
                
            }
            
            
            
            
/*
            
            
            #### Почта
            
            $mail = $db->prepare('select * from `mail` where `kont` = ? and `read` = ?');
            $mail -> execute([
                              $bot->user_id,
                              0
                            ]);
            $mail = $mail -> fetch(PDO :: FETCH_OBJ);
            
            if(isset($mail->id)){
   

    $array = ['привет','hi','ку','хай'];
    
    
        foreach($array as $res){
    preg_match('|'.$key.'|', mb_strtolower($mail->msg), $matches);
        if(isset($matches[0])) $msg = $array[rand(0,3)];
        
        }
        
         
        
        
        if(isset($msg)){
$sql = $db->prepare("INSERT INTO `mail` (`user`,`kont`,`read`,`msg`,`time`) VALUES (?,?,?,?,?)");
$sql->execute([$bot->user_id,$mail->user,0,$msg,time()]);

$add_k = $db->prepare("INSERT INTO `kont` (`id_user`, `id_kont`, `time`) VALUES (?,?,?)");
$add_k -> execute([$bot->user_id,$mail->user,time()]);
$add_u = $db->prepare("INSERT INTO `kont` (`id_user`, `id_kont`, `time`) VALUES (?,?,?)");
$add_k -> execute([$mail->user,$bot->user_id,time()]);

$new = $db->prepare("UPDATE `kont` SET `new_msg` = `new_msg` + ?,`time` = ? WHERE `id_kont` = ? and `id_user` = ?");
$new -> execute([1,time(),$bot->user_id,$mail->user]);
$new2 = $db->prepare("UPDATE `kont` SET  `time` = ? WHERE `id_kont` = ? and `id_user` = ?");
$new2 -> execute([time(),$mail->user,$bot->user_id]);
 $view = $db->prepare("UPDATE `mail` SET `read` = ? WHERE `kont` = ?");
    $view -> execute([1,$bot->user_id]);
    $read = $db->prepare("UPDATE `kont` SET `new_msg` = ? WHERE `id_kont` = ? and `id_user` = ?");
    $read -> execute([0,$mail->user,$bot->user_id]);
        }
            }
           */
Онлайн: 0
Реклама