Файл: aluko/aluko.php
Строк: 182
<?
include './system/common.php';
include './system/functions.php';
include './system/user.php';
if(!$user) header('location: /');
$title = 'Демон Алуко';
include './system/h.php';
?>
<style>
.enemy-hp2 {
position: relative;
overflow: hidden;
margin-left: 3px;
margin-top: 5px;
height: 4px;
background: none repeat scroll 0% 0% #2B2B2B;
border: 2px solid #000;
}
.enemy-hp-remain2 {
float: left;
height: 4px;
}
.hp-green {
background: none repeat scroll 0% 0% #0D6822 !important;
}
</style>
<?
$df1= round(rand($user['def']/15,$user['def']/17));
$df2 = round(rand($user['agi']/10,$user['agi']/9));
$aluk_def = round(rand($df1,$df2));
$my_atk = round(rand($user['str']/6,$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><img src="/images/icon/arena.png">
<font color="green">Алуко повержен!</font></div></div></center>';
include './system/f.php';
exit;
}
if($my_atk >$aluko['health'] && $aluko['health']>0)
{
mysql_query("UPDATE `aluko` SET `health`=0 WHERE `id`='".$aluko['id']."'")or die (mysql_error());
echo '<div class="content"><img src="images/aluko/1.png">
Алуко повержен!</div>';
include './system/f.php';
$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 3");
$topes_us = 'Лучшие в борьбе с Алуко:<br> ';
while($top= mysql_fetch_assoc($top_q)){
$max_uron = mysql_result(mysql_query("SELECT SUM( uron ) FROM `aluko_log` WHERE `user_id`='".$top['user_id']."'"),0);
$moneyReward = $max_uron/20;
mysql_query("UPDATE `users` SET `g`=`g`+".$moneyReward." WHERE `id`='".$top['user_id']."'");
mysql_query("UPDATE `users` SET `exp`=`exp`+".$aluko['exp'].", `g`=`g`+".$moneyReward*rand(2,3)." WHERE `id`='".$top['user_id']."'");
$name_top = mysql_fetch_assoc(mysql_query("SELECT `login` FROM `users` WHERE `id`='".$top['user_id']."' LIMIT 1"));
$topes_us.= '<span class="login">'.$name_top['login'].'</span>('.$max_uron.'- <img src="images/icon/gold.png"> '.$aluko['g'].')<br>';
$aluko['g']=$aluko['g']-4;
$aluko['exp']= round($aluko['exp']/2);
}
mysql_query("INSERT INTO `chat` SET
`user_id`='1',
`text`='".$topes_us."',
`time`='".time()."'");
while($nagr = mysql_fetch_assoc($q_nagr)){
mysql_query("INSERT INTO `journal` SET
`user_id`='".$nagr['user_id']."', `text`='За победу над Алуко Вы получаете <img src="images/icon/gold.png"> ".$aluko['g']."',
`time`='".time()."'");
mysql_query("UPDATE `users` SET `g`=`g`+".$aluko['g'].",`journal`=`journal`+1 WHERE `id`='".$nagr['user_id']."'");
$aluko['g']= round($aluko['g']/2);
mysql_query("DELETE FROM `aluko_log` WHERE `user_id`='".$nagr['user_id']."'");
}
mysql_query("TRUNCATE TABLE `aluko_log`");
}
include './system/f.php';
exit;
}
$aluko['health'] = $aluko['health']-$my_atk;
$aluko_sl = array('ткнул в глаз','нанес урон','порезал','ударил','царапнул');
shuffle($aluko_sl);
$rand_m = rand(1,15);
if($user['mana']<15 ){
?>
<div class ='content'/>
<center>
<h2 class ='dred'/> Вы устали!</h2>
</center>
Восстановите ману!
</div>
<?
include './system/f.php';
exit;
}
/**
* Атака написанная не таким ГК
* @author Alex Priadko
*/
if (isset($_GET['attack']))
{
mysql_query("INSERT INTO `aluko_log` SET
`user_id`='".$user['id']."',
`text`='".$aluko_sl[0]." <b>Алуко</b> на <b>".$my_atk."</b>',
`time`='".time()."',
`uron`='".$my_atk."'");
mysql_query("UPDATE `aluko` SET `health`=`health`-".$my_atk." WHERE `id`='".$aluko['id']."'");
mysql_query("UPDATE `users` SET `mana`=`mana`-".$rand_m.",`mana_resp`='".time()."' 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);
header("Location:?");
exit;
}
$aluko_progress = round(100/($aluko['max_health']/$aluko['health']));
echo '
<div class="content">
<center><img src="http://m.vten.ru/animations/dungeons/uroboros/back.jpg" width = "auto"><br>
</div>
<div class="line"></div>
<div class="content">
Все еще думаешь победить меня,<br>жалкий титан?</center><br>
</div>
<div class="line"></div>
<div class="content">
<div class="enemy-hp2">
<div class="enemy-hp-remain2 hp-green" style="width:'.$aluko_progress.'%"></div>
</div>
<center>Здоровье:
<font color="green">
'.$aluko['health'].'
</font>
/
<font color="green">
'.$aluko['max_health'].'
</font>
</div>
<div class="line"></div>
<div class="list">
<li><a href="?attack" style ="display:block;">
<img src="http://m.vten.ru/images/icons/sword1.png"/>
Бить Алуко!
</a>
</li>
</span>
</span>
';
$aluko_log_q = mysql_query("SELECT * FROM `aluko_log` ORDER BY `time` DESC LIMIT 5");
echo '</div>';
$self = 'Демон Алуко';
$inFight = mysql_num_rows(mysql_query("SELECT `id`,`self` FROM `users`
WHERE `self`='".($self)."' and
`online`>'".(time()-300)."'"));
?>
<div class ='line'/></div>
<div class ='content'/>
<center/>
В бою <?=$inFight;?> титанов
</center>
</div>
<?
echo '
<div class ="line"/></div>
<div class="content"><center>Лог боя
</center>
</div>
<div class ="line"/></div>';
while($aluko_log = mysql_fetch_array($aluko_log_q))
{
$row = mysql_fetch_array(mysql_query("SELECT * FROM `users` WHERE `id`='".$aluko_log['user_id']."'"));
//echo '<a href="user.php?ank='.$ank['id'].'">'.$ank['login'].'</a> '.$aluko_log['text'].'<br>';
?>
<div class ='content'/>
<span class ='float:left;'/>
<img src='/images/icon/race/<?=$row['r'].($row['online'] > (time() - 300) ? '':'-off')?>.png' alt='*'/>
<a href='/user/<?=$row['id']?>/'>
<?=$row['login']?>
</a>
</span>
|
<?=$aluko_log['text'];?>
</div>
<div class ='line'/></div>
<?
}
/**
* Вывод лидеров в бою!
*
*@author AlexPriadko
*/
$queryLiders = mysql_query("SELECT SUM( uron ) , `user_id` FROM `aluko_log`
GROUP BY `user_id`
ORDER BY SUM( uron ) DESC LIMIT 3");
?>
<div class ='content'/>
<center>
Топ 3 бойцов:
</center>
</div>
<div class ='line'/>
</div>
<?
$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 ='content'/>
<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>
<?
}
include './system/f.php';