Файл: public_html/drakon.php
Строк: 261
<?
include './system/common.php';
include './system/functions.php';
include './system/user.php';
if(!$user) header('location: /');
$title = 'Великий Демон';
include './system/h.php';
$df1= round(rand($user['def']/15,$user['def']/170));
$df2 = round(rand($user['agi']/10,$user['agi']/90));
$aluk_def = round(rand($df1,$df2));
$my_atk = round(rand($user['str']/60,$user['str']/4)-$aluk_def);
if ($my_atk<1)
{
$my_atk = $user['level']+rand($user['level'],$user['level']/2);
}
$aluko = mysql_fetch_assoc(mysql_query("SELECT * FROM `aluko` ORDER BY `id` LIMIT 1"));
if($aluko['health']==0){
echo '<div class="main"><div class="block_zero center"><center>
<center><img src="/images/town/town/demon.png" width="100%"></center><br>
<font color="green">Великий Демон повержен, оживает он 4 раза в день в неожиданное (любое) для игроков время!</div></font></center></br>';
include './system/f.php';
exit;
}
if($my_atk >$aluko['health'] and $aluko['health']!=0){
mysql_query("UPDATE `aluko` SET `health`=0 WHERE `id`='".$aluko['id']."'")or die (mysql_error());
echo '<div class="main"><center><img src="images/icon/arena.png">Великий Демон повержен, он оживает в течении дня каждые 2часа!</div></center>';
$total = mysql_result(mysql_query("SELECT COUNT(*) FROM `aluko_log`"),0);
if($total>0){
$q_nagr = mysql_query("SELECT * FROM `aluko_log` GROUP BY `user_id` ORDER BY RAND()");
/*3 лучших */
$top_q = mysql_query("SELECT SUM(uron) , `user_id` FROM `aluko_log` GROUP BY `user_id` ORDER BY SUM(uron) DESC LIMIT 5");
$topes_us = '[center]Результат сражения с Демоном[/center][br] ';
while($top= mysql_fetch_assoc($top_q)){
mysql_query("UPDATE `users` SET `g`=`g`+".$aluko['money']." WHERE `id`='".$top['user_id']."'");
// Рассчёт награды
$max_uron = mysql_result(mysql_query("SELECT SUM( uron ) FROM `aluko_log` WHERE `user_id`='".$top['user_id']."'"),0);
$cena_uron=1; // монет за единицу урона
$uron_money=$max_uron/10000;
$_gold = rand(1000,7000);
// Рассчёт награды
// Пишем в журнал
if($max_uron >70000){
mysql_query("INSERT INTO `journal` SET `user_id`='".$top['user_id']."',`text`='Вы один из лучших (нанесли ".$max_uron." урона).Ваша награда <img src="images/icon/exp.png"> ".$aluko['exp']." <img src="images/icon/gold.png"> ".$_gold." и <img src="images/icon/silver.png"> ".$uron_money."',`time`='".time()."'");
mysql_query("UPDATE `users` SET `exp`=`exp`+".$aluko['exp'].", `s`=`s`+".$uron_money.",`journal`=`journal`+1,`g`=`g`+ ".$_gold." WHERE `id`='".$top['user_id']."'");
mysql_query("UPDATE `users` SET `s`=`s`+".$aluko['s'].",`journal`=`journal`+1 WHERE `id`='".$nagr['user_id']."'");
}
$name_top = mysql_fetch_assoc(mysql_query("SELECT `login` FROM `users` WHERE `id`='".$top['user_id']."' LIMIT 1"));
if($name_top['sex'] ==1){ $sex= 'cла';}else{ $sex='c';}
$topes_us.= ''.$name_top['login'].' (Нане'.$sex.' '.$max_uron.' урона )[br]';
$aluko['s']=$aluko['s']-4;
$aluko['exp']= round($aluko['exp']/2);
}
mysql_query("INSERT INTO `chat` SET `user`='1', `text`='".$topes_us."', `time`='".time()."'");
#sleep(1);
//////
mysql_query("TRUNCATE TABLE `aluko_log`");
}
include './system/f.php';
exit;
}
$aluko['health'] = $aluko['health']-$my_atk;
$aluko_sl = array('<font color="green">ударил</font>','<font color="darkred">нанес урон</font>','<font color="red">порезал</font>','<font color="gold">побил</font>','<font color="orange">царапнул</font>');
shuffle($aluko_sl);
if($user['mp']<55){
echo '<div id="error"><center><font color="#c06060">Для нападения надо минимум <img src="/images/icon/mana.png" alt="*"/> 55 маны</font></center></div>
';?>
<center><a class="btn22" href="/lab/wiz/?potion=true&referal=/drakon.php?<=md5(time())?>"><h1>Восстановить ману!</h1></center>
</a>
<?
echo'<center>Здоровье Демона:<font color="green"> '.$aluko['health'].'</font>/<font color="green">'.$aluko['max_health'].'</font></center>';
$aluko_log_q = mysql_query("SELECT * FROM `aluko_log` ORDER BY `time` DESC LIMIT 3");
echo '</div><div class="main"><div class="block_zero"><center><font color="yellow">Лог боя</font><br>';
while($aluko_log = mysql_fetch_assoc($aluko_log_q)){
$ank = mysql_fetch_assoc(mysql_query("SELECT * FROM `users` WHERE `id`='".$aluko_log['user_id']."'"));
echo '<a href="user.php?id='.$ank['id'].'">'.$ank['login'].'</a> '.$aluko_log['text'].'<br>';
}
echo '</center>';
include './system/f.php';
exit;
}
if($user['hp']<500){
echo '<div id="error"><font color="#c06060"><center>Вы погибли в бою , дождитесь окончания боя или восстановите у целительницы здоровье!!!</font></center></div>';
echo'<center>Здоровье Демона:<font color="green"> '.$aluko['health'].'</font>/<font color="green">'.$aluko['max_health'].'</font></center>';
$aluko_log_q = mysql_query("SELECT * FROM `aluko_log` ORDER BY `time` DESC LIMIT 5");
echo '</div><div class="main"><div class="block_zero"><center><font color="yellow">Лог боя</font><br>';
while($aluko_log = mysql_fetch_assoc($aluko_log_q)){
$ank = mysql_fetch_assoc(mysql_query("SELECT * FROM `users` WHERE `id`='".$aluko_log['user_id']."'"));
echo '<a href="user.php?id='.$ank['id'].'">'.$ank['login'].'</a> '.$aluko_log['text'].'<br>';
}
echo '</center>';
include './system/f.php';
exit;
}
$color='<font color="Crimson">';
mysql_query("INSERT INTO `aluko_log` SET `user_id`='".$user['id']."',`text`='".$aluko_sl[0]." <b>Демона</b> на <b>".$color."".$my_atk."</font></b>',`time`='".time()."',`uron`='".$my_atk."'");
$_hp = rand(1,400);
$_mp = rand(25,35);
$_s = rand(250,3500);
$_exp = rand(250,1050);
$_g = rand(10,15);
mysql_query("UPDATE `aluko` SET `health`=`health`-".$my_atk." WHERE `id`='".$aluko['id']."'");
mysql_query('UPDATE `users` SET `hp` = `hp` - '.$_hp.' WHERE `id` = "'.$user['id'].'"');
mysql_query('UPDATE `users` SET `mp` = `mp` - '.$_mp.' WHERE `id` = "'.$user['id'].'"');
if($clan && $clan['obelisk'] > 0) {
$_exp += round($_exp/10) * $clan['obelisk'];
if($clan && $clan['obelisk'] > 0) {
$_s += round($_exp/10) * $clan['obelisk'];
mysql_query('UPDATE `users` SET `s` = `s` + '.$_s.' WHERE `id` = "'.$user['id'].'"');
mysql_query('UPDATE `users` SET `exp` = `exp` + '.$_exp.' WHERE `id` = "'.$user['id'].'"');
}
}
mysql_query('UPDATE `users` SET `g` = `g` + '.$_g.' WHERE `id` = "'.$user['id'].'"');
$all_uron = mysql_result(mysql_query("SELECT SUM( uron )FROM `aluko_log` WHERE `user_id`='".$user['id']."'"),0);
$perc_health_aluko = round($aluko['health']/$aluko['max_health']*100,2);
$myLog = mysql_query("SELECT * FROM `aluko_log` WHERE `user_id` = '$myID' AND `id_user` = '$myID' AND `tipe` = 'user' ORDER BY `id` DESC LIMIT 1");
$myLog = mysql_fetch_array($myLog);
echo '<div class="main">
<div class="block_zero center">
<center><a href="/drakon.php?session='.md5(time()).'"><img src="/images/town/town/demon.png" width="100%"></a><br><div class="pvp_fon">
<div class="separ"></div>
<div class="separ"></div>
<font color="violet"><small>Вижу вас стало больше, но моя сила велика, сдайтесь и я сохраню вам жизнь...</small></font>
<div class="separ"></div>
Самое сильное существо мира Эпохи Титанов ожило!!! <br> Хватай меч и сражайся
<br><font color="red">Награда до '.n_f($aluko['money']).' золота</font>
<div class="separ"></div>
<center>Здоровье:<font color="green"> '.$aluko['health'].'</font>/<font color="green">'.$aluko['max_health'].'</font></center>
<div class="separ"></div>
<center>
<a class="btn22" href="/drakon.php?session='.md5(time()).'"><span class="end"><span class="label">
<img src="/images/icon/ok.png">Атаковать</span></span></a></span></span>';
if($myLog['time'] > time())echo "[".tl($myLog['time']-time())."]";
echo'<a class="btn22" href="/drakon.php?session='.md5(time()).'" data-ajax><span class="end"><span class="label">
<img src="/images/icon/ok.png">Атаковать</span></span></center></a></span></span>';
if($myLog['time'] > time())echo "[".tl($myLog['time']-time())."]";
echo'
<a class="btn22" href="/effshop.php" data-ajax><span class="end"><span class="label">
<img src="http://tiwar.ru/images/icon/equip.png">
Активировать Эффекты</span></span></center></a></span></span>';
$aluko_log_q = mysql_query("SELECT * FROM `aluko_log` ORDER BY `time` DESC LIMIT 10");
echo '<center><font color="yellow">Лог боя</font><br>';
while($aluko_log = mysql_fetch_array($aluko_log_q))
{
$row = mysql_fetch_array(mysql_query("SELECT * FROM `users` WHERE `id`='".$aluko_log['user_id']."'"));
?>
<div class ='conten'/>
<span class ='float:left;'/>
<img src='/images/icon/race/<?=$row['r'].($row['online'] > (time() - 2000) ? '':'-off')?>.png' alt='*'/>
<a href='/user/<?=$row['id']?>/'>
<?=$row['login']?>
</a></span> | <?=$aluko_log['text'];?></div>
<div class='dot-line'></div>
<?
}
$queryLiders = mysql_query("SELECT SUM( uron ) , `user_id` FROM `aluko_log`GROUP BY `user_id` ORDER BY SUM( uron ) DESC LIMIT 3");
?>
<div class ='title'/>
<center>Топ 3 бойцов:</center></div>
<div class ='mini-line'/></div>
<a class="btn22" href="/lab/wiz/?potion=true&referal=/drakon.php?">
<center><h1>Восстановить ману!</h1></center>
</a><br>
<?
$alPos = 0;
while ($liders = mysql_fetch_array($queryLiders))
{
$alPos++;
$row = mysql_fetch_array(mysql_query("SELECT * FROM `users` WHERE `id`='".$liders['user_id']."'"));
$damageUs = mysql_result(mysql_query("SELECT SUM( uron ) , `user_id` FROM `aluko_log`WHERE `user_id`='".$liders['user_id']."'"),0);
?>
<div class ='conten'/>
<span class ='float:left;'/>
<?=$alPos;?>.<img src='/images/icon/race/<?=$row['r'].($row['online'] > (time() - 300) ? '':'-off')?>.png' alt='*'/>
<a href='/user/<?=$row['id']?>/'>
<?=$row['login'];?></a></span>
<span class ='float:right;'/>
<?=$damageUs;?>
</span></div>
<div class ='dl'/></div>
<?
}
echo '</div>';
include './system/f.php';
?>
</div><br>