<?php
include 'core/system.php';
// Добовляем раз в 10 минут

//если в течении последних 15 минут больше 1 килла и больше 1 урона то заносим эфир +20 . когда эфир достигнет 100 выдаем вещь



    $un = 10800 + TIME;
$elis = $dbc->query("SELECT * FROM `adgame_info` ORDER BY `id` LIMIT 1")->fetch_assoc();  



  
if($elis['uron']>=0 and $elis['kill']>=0){    


$dbc->query("UPDATE `adgame_info` SET `efir`=`efir`+5 ,`uron`=0,`kill`=0 , `time`  =  '". (time() + 600)."'");    









}












$final= $dbc->query("SELECT * FROM `adgame_info` ORDER BY `id` LIMIT 1")->fetch_assoc();  


if($final['efir']>=100){ 


$ers = $dbc->query("SELECT * FROM `dop` WHERE `adg_kill`>9");

while($ty = $ers->fetch_assoc()){  




$dbc->query("update `users` set `gold` = `gold`+20 where `id` = '".$ty['user']."'");  






$ney  = $ty['user'];
$dbc->query("INSERT INTO `journal` SET `user_id`='".$ney."', `text`='Эфир взорвался . ваша награда <img src=/img/money/money.png>20   ',





    `time`='".time()."'");
$dbc->query("UPDATE `users` SET `journal`=`journal`+1 WHERE `id`='".$ney."'"); 






}
$wint = $dbc->query("SELECT * FROM `dop` WHERE `adg_uron`>100000 AND `adg_kill`>4 ORDER BY RAND()")->fetch_assoc(); 



if($wint){




$win = $dbc->query("SELECT * FROM `users` WHERE `id`='".$wint['user']."'")->fetch_assoc(); 


$wow = array('iEpic','iLegendary');
shuffle($wow);

$shmot = $dbc->query("SELECT * FROM `uart` WHERE `lite`='".$wow[0]."' AND `class`='".$win['pers']."'      ORDER BY RAND()")->fetch_assoc(); 















$dbc->query("INSERT INTO `artefact` (user_id,status,nik,strong,hp,prot,crit,regen,level,tip,class,lite,coin,img,vamp,sok,art) values('".$win['id']."','".$shmot['status']."','".$shmot['nik']."','".$shmot['strong']."','".$shmot['hp']."','".$shmot['prot']."','".$shmot['crit']."','".$shmot['regen']."','".$shmot['level']."','".$shmot['tip']."','".$win['pers']."','".$shmot['lite']."','".$shmot['coin']."','".$shmot['img']."','".$shmot['vamp']."','".$shmot['sok']."',0)"); 







$last = $dbc->insert_id;


$topes_us = '<font color=blueviolet><a

href="/info_art.php?ids='.

$last.'">'.$shmot[nik].'</a> для <img src="img/class/'.$win['storona'].'/'.$win['pers'].'/pers.png" width="14" height="14" alt="*"><b><a href="pers.php?ank='.$win['id'].'"<font color=green> '.$win['login'].'</font></b></a></br>';


$tebe = 'Поздравлем!! хранитель покоя выбрал вас. сформировав из темной материи очередную вещь :<a

href="/info_art.php?ids='.

$last.'">'.$shmot[nik].'</a></b></a></br>';

$neys = $win['id'];

$dbc->query("UPDATE `adgame_info` SET `text`='.$topes_us.'");


$dbc->query("INSERT INTO `journal` SET `user_id`='".$neys."', `text`='".$tebe."</a>',




    `time`='".time()."'");
$dbc->query("UPDATE `users` SET `journal`=`journal`+1 WHERE `id`='".$neys."'"); 

}
                
$dbc->query("UPDATE `dop` SET `adg_uron`=0,`adg_kill`=0 WHERE `adg_uron`>0");


$dbc->query("UPDATE `dop` SET `koron`=`koron`+1 WHERE `user` = '".$win['id']."'");
$dbc->query("UPDATE `adgame_info` SET `uron`=0,`kill`=0,`efir`=0");
}








?> 

