Файл: aluko.php
Строк: 178
<?
require_once 'core/system.php';
echo only_reg();
$header = 'Король Титанов';
require_once 'core/head.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">Король повержен! Теперь Ждите 5часов покаместь он воскреснит</font></div></div></center>';
include './core/foot.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">
Король повержен! Теперь ждите 5часов покаместь он воскреснит</div>';
include './core/foot.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 `user` SET `gold`=`gold`+".$moneyReward." WHERE `id`='".$top['user_id']."'");
mysql_query("UPDATE `user` SET `exp`=`exp`+".$aluko['exp'].", `gold`=`gold`+".$moneyReward*rand(2,3)." WHERE `id`='".$top['user_id']."'");
$name_top = mysql_fetch_assoc(mysql_query("SELECT `nick` FROM `user` WHERE `id`='".$top['user_id']."' LIMIT 1"));
$topes_us.= '<span class="login">'.$name_top['nick'].'</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 `user` SET `gold`=`gold`+".$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 './core/foot.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 './core/foot.php';
exit;
}
/**
* Атака написанная не таким ГК
* @author vk.com/elfi68
*/
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 `user` 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 = '/aluko.php';
$inFight = mysql_num_rows(mysql_query("SELECT `id`,`self` FROM `user`
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 `user` 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/1.png/<?=$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 vk.com/elfi68
*/
$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 `user`
WHERE `id`='".$liders['users_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>
<?
}
require_once 'core/foot.php';