Файл: public_html/hellworld.php
Строк: 390
<?
include './system/common.php';
include './system/functions.php';
include './system/user.php';
if(!$user) {
header('location: /');
exit;
}
$title = 'Огненные земли';
include './system/h.php';
switch($_GET['i']){
default:
if($user['hellworld_reward'] == 0) mysql_query('UPDATE `users` SET `hellworld_reward` = 1 WHERE `id` = "'.$user['id'].'" LIMIT 1');
if(isset($_GET['nagrada'])){
$id = _string(_num($_GET['nagrada']));
$hellworld_action = mysql_fetch_array(mysql_query('SELECT * FROM `hellworld_action` WHERE `id` = "'.$id.'" AND `user` = "'.$user['id'].'" LIMIT 1'));
if($hellworld_action){
if(!$id or !$hellworld_action or $hellworld_action['hp'] > 0){
header('Location:/');
exit;
}
else{
mysql_query('UPDATE `users` SET `hellworld` = 0, `hellworld_stage` = 0,`exp` = `exp` + "'.$hellworld_action['exp'].'" WHERE `id` = '.$user['id'].' LIMIT 1');
mysql_query('DELETE FROM `hellworld_action` WHERE `user` = "'.$user['id'].'"');
mysql_query('DELETE FROM `hellworld_logs` WHERE `user` = "'.$user['id'].'"');
mysql_query('INSERT INTO `hellworld_user` SET `user` = "'.$user['id'].'", `creature` = "'.$hellworld_action['creature'].'", `time` = "'.time().'", `respawn` = "'.(time() + 3600).'" ');
}
echo '
<div class="center">
<div class="block_light">
<img src="/images/icon/2hit.png" alt="" />
<span class="dgreen bold">
<center>Победа!
</span>
<img src="/images/icon/2hit.png" alt="" />
<br />
Вы одержали победу над
<img src="/images/icon/2hit.png" alt="" />
'.$hellworld_action['name'].'!
<br />
<div class="separ"></div>
<span class="blue">
Награда:
</span>
<img src="/images/icon/exp.png" alt="exp" />
'.$hellworld_action['exp'].' опыта
<br /> </center>
</div>
<div class="mini-line"></div>
</div>
';
goto index;
}
else{
header('Location: /hellworld/');
exit;
}
}
if($user['hellworld'] == 0){
echo '
<div class="content center">
<div class="block_zero blue">
<font color="green">Убивай монстров, получай особую наградy
</font>
</div>
<div class="mini-line"></div>
</div>
';
index:
$hellworld_reward = mysql_fetch_array(mysql_query('SELECT * FROM `hellworld_rewards` WHERE `id` = "'.$user['hellworld_reward'].'" LIMIT 1'));
$item = mysql_fetch_array(mysql_query('SELECT * FROM `items` WHERE `id` = "'.$hellworld_reward['item'].'" LIMIT 1'));
echo '
<div class="content" align="center">
<span class="dgreen bold">
Особая награда
</span>
<div class="separ"></div>
<div style="display:inline-block;white-space:nowrap;">
<span class="yellow">
<img src="/itemImage.php?id='.$hellworld_reward['item'].'" alt="" width="50" height="50" style="float:left;margin-right:3px;margin-top:3px;" />
</span>
<img src="/images/icon/quality/'.$item['quality'].'.png" alt="*" />
<span class="yellow">
'.$item['name'].'
</span>
</div>
<div class="separ"></div>
<div class="center">
<img src="/images/icon/exp.png" alt="" />
Опыт: '.$user['hellworld_exp'].' из '.$hellworld_reward['exp'].'
<br />
<a class="btn" href="/hellworld/reward/">
<span class="end">
<span class="label">
<font color="green">Подробней</font>
</span>
</span>
</a>
</div>
</div>
';
$hellworld_user_count = mysql_result(mysql_query('SELECT COUNT(*) FROM `hellworld_user` WHERE `user` = "'.$user['id'].'"'),0);
$_hellworld_creature = mysql_query('SELECT * FROM `hellworld` LIMIT '.($hellworld_user_count + 1).'');
while($hellworld_creature = mysql_fetch_array($_hellworld_creature)){
$hellworld_user = mysql_fetch_array(mysql_query('SELECT * FROM `hellworld_user` WHERE `user` = "'.$user['id'].'" AND `creature` = "'.$hellworld_creature['id'].'" LIMIT 1'));
echo'
<div class="content">
<div class="line"></div>
<div class="block_zero" style="display:inline-block;white-space:nowrap;text-align:left;">
'.($hellworld_user ? '
<a href="/hellworld/info/'.$hellworld_creature['id'].'/">
<img src="/images/monsters/hellworld/'.$hellworld_creature['id'].'.png" alt="" style="margin-right:3px;float:left;" />
</a>
':'
<img src="/images/monsters/hellworld/'.$hellworld_creature['id'].'.png" alt="" style="margin-right:3px;float:left;" />
').'
<img src="/images/icon/2hit.png" alt="" />
<span class="yellow">
'.$hellworld_creature['name'].'
</span>
<br />
<span class="medium">
<img src="/images/icon/quality/'.$hellworld_creature['quality'].'.png" alt="" />
<span class="quality-'.$hellworld_creature['quality'].'">
'.($hellworld_creature['quality'] == 0 ? 'Простой' :
($hellworld_creature['quality'] == 1 ? 'Обычный' :
($hellworld_creature['quality'] == 2 ? 'Редкий' :
($hellworld_creature['quality'] == 3 ? 'Эпический' :
($hellworld_creature['quality'] == 4 ? 'Легендарный' :
($hellworld_creature['quality'] == 5 ? 'Божественный' :
($hellworld_creature['quality'] == 6 ? 'Сверх Божественный' :
''))))))).'
</span>
<br />
'.($hellworld_user ? '
<span class="grey">
Воскреснет через: '.(ceil(($hellworld_user['respawn'] - time()) / 60 / 1)).' минут
</span>
':'
<span class="blue">
Награда:
</span>
<img src="/images/icon/exp.png" alt="" />
'.$hellworld_creature['exp'].' опыта
').'
</span>
<div class="clear:both;"></div>
<div class="mb10"></div>
'.($hellworld_user ? '' : '
<a class="btn" href="/hellworld/info/'.$hellworld_creature['id'].'/">
<span class="end">
<span class="label">
В бой!
</span>
</span>
</a>
').'
</div>
</div>
';
}
}
else{
$hellworld_action = mysql_fetch_array(mysql_query('SELECT * FROM `hellworld_action` WHERE `user` = '.$user['id'].' LIMIT 1'));
if(!$hellworld_action){
header('Location:/');
exit;
}
$hellworld_log = mysql_fetch_array(mysql_query('SELECT `dead` FROM `hellworld_logs` WHERE `user` = "'.$user['id'].'" ORDER BY `id` DESC'));
echo ($hellworld_log['dead'] ? '
<div class="content center">
<div class="block_zero">
<span class="dred">
<center>Ваш герой погиб
</span>
<br />
Ожидайте конца боя
<br /></center>
</div>
<div class="dot-line"></div>
<div class="block_zero">
<a class="btn" href="/hellworld/">
<span class="end">
<span class="label">
Завершить бой
</span>
</span>
</a>
</div>
</div>
' : '
<div class="content center">
<table align="center">
<tr valign="top">
<td>
<img src="/images/monsters/hellworld/'.$hellworld_action['creature'].'.png" alt="" style="margin-right:3px;" />
</td>
<td align="left">
<img src="/images/icon/2hit.png" alt="" />
<span class="yellow">
'.$hellworld_action['name'].'
</span>
<br />
Здоровье:
<img src="/images/icon/health.png" alt="" />
'.$hellworld_action['hp'].'
<br />
</td>
</tr>
</table>
<div class="dot-line"></div>
<div class="block_zero">
'.($hellworld_action['hp'] > 0 ? '
<a class="btn" href="/hellworld/attack/'.$hellworld_action['id'].'/">
<span class="end">
<span class="label">
Атаковать
</span>
</span>
</a>
' : '
<a class="btn" href="/hellworld/nagrada/'.$hellworld_action['id'].'/">
<span class="end">
<span class="label">
Завершить бой
</span>
</span>
</a>
').'
</div>
</div>
').'
<div class="line"></div>
<div class="content log">
';
$_hellworld_logs = mysql_query('SELECT * FROM `hellworld_logs` WHERE `user` = "'.$user['id'].'" ORDER BY `id` DESC');
while($hellworld_logs = mysql_fetch_array($_hellworld_logs)){
echo ($hellworld_logs['dead'] ? '
<img src="/images/icon/rip.png" alt="" />
<img src="/images/icon/race/bot.png" alt="" />
<span class="dred">
Босс убил Вас
</span>
<br />
' :($hellworld_logs['text'] ? '
<img src="/images/icon/rip.png" alt="" />
Вы убили
<img src="/images/icon/race/bot.png" alt="" />
'.$hellworld_action['name'].'
<br />
' :($hellworld_logs['usery'] ? '
<span class="dred">
<img src="/images/icon/race/bot.png" alt="" />
'.$hellworld_action['name'].' ударил Вас на
<span class="bold">
'.$hellworld_logs['usery'].'
</span>
</span>
<br />
':'
Вы ударили
<img src="/images/icon/race/bot.png" alt="" />
'.$hellworld_action['name'].' на
<span class="bold">
'.$hellworld_logs['dmg'].'
</span>
<br />'))).'
';
}
echo'
</div>
';
}
if($hellworld_log['dead']){
mysql_query('UPDATE `users` SET `hellworld` = 0, `hellworld_stage` = 0 WHERE `id` = '.$user['id'].' LIMIT 1');
mysql_query('DELETE FROM `hellworld_action` WHERE `user` = "'.$user['id'].'"');
mysql_query('DELETE FROM `hellworld_logs` WHERE `user` = "'.$user['id'].'"');
}
break;
case 'attack':
$id = _string(_num($_GET['id']));
$hellworld_action = mysql_fetch_array(mysql_query('SELECT * FROM `hellworld_action` WHERE `id` = '.$id.' LIMIT 1'));
$usery +=rand($hellworld_action['str_min'],$hellworld_action['str_max']);
$usery -= round(rand(($user['def']/12),($user['def']/7)));
$dmg = rand(round($user['str']/6),round($user['str']/4));
if($usery < 0) $usery = 0;
if(!$id or !$hellworld_action){
header('Location:/');
exit;
}
elseif($user['hp'] - $usery <= 0){
mysql_query('UPDATE `users` SET `hp` = "'.($user['vit']*2).'" WHERE `id` = "'.$user['id'].'" LIMIT 1');
if($hellworld_action['hp'] - $dmg <= 0){
goto a;
}
mysql_query('INSERT INTO `hellworld_logs` SET `user` = "'.$user['id'].'", `dmg` = "'.$dmg.'", `action` = "'.$hellworld_action['id'].'", `time` = "'.time().'"');
mysql_query('INSERT INTO `hellworld_logs` SET `user` = "'.$user['id'].'", `dead` = "'.$usery.'", `action` = "'.$hellworld_action['id'].'", `time` = "'.time().'"');
header('Location:/hellworld/');
exit;
}
elseif($hellworld_action['hp'] > 0){
a:
mysql_query('INSERT INTO `hellworld_logs` SET `user` = "'.$user['id'].'", `dmg` = "'.$dmg.'", `action` = "'.$hellworld_action['id'].'", `time` = "'.time().'"');
if($hellworld_action['hp'] - $dmg <= 0){
mysql_query('UPDATE `users` SET `hp` = "'.($user['vit']*2).'", `hellworld_exp` = `hellworld_exp` + '.$hellworld_action['exp'].' WHERE `id` = "'.$user['id'].'" LIMIT 1');
mysql_query('INSERT INTO `hellworld_logs` SET `user` = "'.$user['id'].'", `action` = "'.$hellworld_action['id'].'", `time` = "'.time().'", `text` = "'.$hellworld_action['name'].'"');
}
if($hellworld_action['hp'] - $dmg > 0){
mysql_query('INSERT INTO `hellworld_logs` SET `user` = "'.$user['id'].'", `usery` = "'.$usery.'", `action` = "'.$hellworld_action['id'].'", `time` = "'.time().'"');
mysql_query('UPDATE `users` SET `hp` = `hp` - "'.$usery.'" WHERE `id` = "'.$user['id'].'" LIMIT 1');
}
else mysql_query('UPDATE `hellworld_action` SET `hp` = 0 WHERE `user` = "'.$user['id'].'" AND `id` = "'.$hellworld_action['id'].'"');
if($hellworld_action['hp'] - $dmg > 0) mysql_query('UPDATE `hellworld_action` SET `hp` = `hp` - "'.$dmg.'" WHERE `user` = "'.$user['id'].'" AND `id` = "'.$hellworld_action['id'].'"');
else mysql_query('UPDATE `hellworld_action` SET `hp` = 0 WHERE `user` = "'.$user['id'].'" AND `id` = "'.$hellworld_action['id'].'"');
header('Location:/hellworld/');
exit;
}
else{
header('Location:/hellworld/');
exit;
}
break;
case 'info':
$id = _string(_num($_GET['id']));
$hellworld_user_count = mysql_result(mysql_query('SELECT COUNT(*) FROM `hellworld_user` WHERE `user` = "'.$user['id'].'"'),0);
$hellworld_creature = mysql_fetch_array(mysql_query('SELECT * FROM `hellworld` WHERE `id` = "'.$id.'" LIMIT 1'));
if(!$id or !$hellworld_creature or $hellworld_user_count + 1 < $id){
header('Location:/');
exit;
}
$hellworld_user = mysql_fetch_array(mysql_query('SELECT * FROM `hellworld_user` WHERE `user` = "'.$user['id'].'" AND `creature` = "'.$hellworld_creature['id'].'" LIMIT 1'));
echo'
<div class="content">
<div class="block_zero">
<div style="display:inline-block;white-space:nowrap;text-align:left;">
<img src="/images/monsters/hellworld/'.$hellworld_creature['id'].'-big.png" alt="" style="margin-right:3px;float:left;" />
<img src="/images/icon/2hit.png" alt="" />
<span class="yellow">
'.$hellworld_creature['name'].'
</span>
<br />
<img src="/images/icon/quality/'.$hellworld_creature['quality'].'.png" alt="" />
<span class="quality-'.$hellworld_creature['quality'].' medium">
'.($hellworld_creature['quality'] == 0 ? 'Простой' :
($hellworld_creature['quality'] == 1 ? 'Обычный' :
($hellworld_creature['quality'] == 2 ? 'Редкий' :
($hellworld_creature['quality'] == 3 ? 'Эпический' :
($hellworld_creature['quality'] == 4 ? 'Легендарный' :
($hellworld_creature['quality'] == 5 ? 'Божественный' :
($hellworld_creature['quality'] == 6 ? 'Сверх Божественный' :
''))))))).'
</span>
<br />
<img src="/images/icon/hit.png" alt="" />
Урон: '.$hellworld_creature['str_min'].'-'.$hellworld_creature['str_max'].'
<br />
<img src="/images/icon/health.png" alt="" />
Здоровье: '.$hellworld_creature['hp'].'
<br />
<img src="/images/icon/exp.png" alt="" />
<span class="blue">
Награда:
</span>
'.$hellworld_creature['exp'].' опыта
<br />
<br />
'.($hellworld_user ? '
<span class="grey">
Воскреснет через: '.(ceil(($hellworld_user['respawn'] - time()) / 60 / 60)).' часов
</span>
':'
<a class="btn" href="/hellworld/enter/'.$id.'/">
<span class="end">
<span class="label">
Атаковать
</span>
</span>
</a>
').'
</div>
<div class="clear:both;"></div>
</div>
</div>
<div class="line"></div>
<div class="content">
<div class="menuList">
<a href="/hellworld/">
<img src="/images/icon/hellworld.png" alt="">
Огненные земли
</a>
</div>
</div>
<div class="mini-line"></div>
<div class="content">
<ul class="hint">
<font color="#FFDAB9"><li>
Бой с монстром состоит из 5 раундов
</li>
<li>
Если по окончанию боя все живы, побеждает тот, кто нанес больше всего урона
</li></font>
</ul>
</div>
<div class="line"></div>
';
break;
case 'enter':
$id = _string(_num($_GET['id']));
$hellworld_creature = mysql_fetch_array(mysql_query('SELECT * FROM `hellworld` WHERE `id` = '.$id.' LIMIT 1'));
$hellworld_action = mysql_fetch_array(mysql_query('SELECT * FROM `hellworld_action` WHERE `user` = '.$user['id'].' LIMIT 1'));
$hellworld_user = mysql_fetch_array(mysql_query('SELECT * FROM `hellworld_user` WHERE `user` = "'.$user['id'].'" AND `creature` = "'.$hellworld_creature['id'].'" LIMIT 1'));
$hellworld_user_count = mysql_result(mysql_query('SELECT COUNT(*) FROM `hellworld_user` WHERE `user` = "'.$user['id'].'"'),0);
if($hellworld_user or !$id or !$hellworld_creature or $hellworld_action or $hellworld_user_count + 1 < $id){
header('Location:/');
exit;
}
else{
mysql_query('UPDATE `users` SET `hellworld` = '.$id.' WHERE `id` = '.$user['id'].' LIMIT 1');
mysql_query('INSERT INTO `hellworld_action` SET `user` = '.$user['id'].', `name` = "'.$hellworld_creature['name'].'", `creature` = "'.$hellworld_creature['id'].'", `str_min` = "'.$hellworld_creature['str_min'].'", `str_max` = "'.$hellworld_creature['str_max'].'", `hp` = "'.$hellworld_creature['hp'].'", `max_hp` = "'.$hellworld_creature['hp'].'", `exp` = "'.$hellworld_creature['exp'].'", `time` = "'.time().'"');
header('Location:/hellworld/');
exit;
}
break;
case 'reward':
$hellworld_reward = mysql_fetch_array(mysql_query('SELECT * FROM `hellworld_rewards` WHERE `id` = "'.$user['hellworld_reward'].'" LIMIT 1'));
$item = mysql_fetch_array(mysql_query('SELECT * FROM `items` WHERE `id` = "'.$hellworld_reward['item'].'" LIMIT 1'));
if(isset($_GET['take'])){
$shop = mysql_fetch_array(mysql_query('SELECT * FROM `shop` WHERE `id` = "'.$hellworld_reward['item'].'"'));
if($hellworld_reward && $user['hellworld_exp'] >= $hellworld_reward['exp']){
mysql_query('INSERT INTO `inv` (`user`,`item`,`quality`,`bonus`,`_str`,`_vit`,`_agi`,`_def`,`place`,`equip`) VALUES (''.$user['id'].'',''.$shop['id'].'',''.$shop['quality'].'',''.$shop['bonus'].'',''.$shop['_str'].'',''.$shop['_vit'].'',''.$shop['_agi'].'',''.$shop['_def'].'','0','0')');
mysql_query('UPDATE `users` SET '.($hellworld_reward['g'] ? '`g` = `g` - '.$hellworld_reward['g'].',' : '`s` = `s` - '.$hellworld_reward['s'].',').' `hellworld_exp` = 0, `hellworld_reward` = `hellworld_reward` + 1 WHERE `id` = "'.$user['id'].'" LIMIT 1');
header('Location:/hellworld/');
exit;
}
}
echo '
<div class="block_zero content">
<div style="display:inline-block;white-space:nowrap;">
<span class="yellow">
<img src="/itemImage.php?id='.$hellworld_reward['item'].'" alt="" width="50" height="50" style="float:left;margin-right:3px;margin-top:3px;" />
</span>
<img src="/images/icon/quality/'.$item['quality'].'.png" alt="*" />
<span class="yellow">
'.$item['name'].'
</span>
</div>
</div>
<div class="mini-line"></div>
<div class="block_zero content">
<img src="/images/icon/exp.png" alt="" />
Опыт: '.$user['hellworld_exp'].' из '.$hellworld_reward['exp'].'
<br />
<span class="dgreen medium">
Чтобы получить вещь, зарабатывайте опыт сражаясь с монстрами
</span>
</div>
<div class="mini-line"></div>
'.($user['hellworld_exp'] >= $hellworld_reward['exp'] ? '
<div class="block_zero content center">
<a class="btn" href="/hellworld/reward/take/">
<span class="end">
<span class="label">
Купить сейчас
</span>
</span>
</a>
<br />
<span class="grey">
'.($hellworld_reward['g'] ? '
<img src="/images/icon/gold.png" alt="" />
'.$hellworld_reward['g'].' золота
':'
<img src="/images/icon/silver.png" alt="" />
'.$hellworld_reward['s'].' серебра
').'
</span>
<div class="mb10"></div>
</div>
' : '
<div class="block_zero content center"></div>
').'
<div class="mini-line"></div>
<div class="menuList content">
<li>
<a href="/hellworld/">
<img src="/images/icon/hellworld.png" alt="" />
Огненные земли
</a>
</li>
</div>
<div class="mini-line"></div>
<div class="content">
<ul class="hint">
<font color="green"><li>
Чем больше прогресс награды, тем дешевле можно ее купить
</li>
<li>
При достижении прогресса в 25%, уже можно купить награду
</li>
<li>
Существуют бесплатные награды, которые можно получить при достижении 100% прогресса
</li>
<li>
При смене вещи текущий прогресс пропадет
</li></font>
</ul>
</div>
<div class="line"></div>
';
break;
}
include './system/f.php';
?>