Файл: sumerki.mobi/sumerki.mobi/zamok.php
Строк: 203
<?
//////////////////////////////////////////////////////////////
//////////////////////Онлайн игра "Сумерки"///////////////////
//////////////////////Основатель: Mc Laren////////////////////
///////////////////Контакты: ICQ - 597687549//////////////////
/////////////////////Пример: Sumerki.Mobi/////////////////////
///////////Если ты это читаешь, значит скрипт слили :D////////
//////////////////////////////////////////////////////////////
define('PROTECTOR', 1);
$headmod = 'zamok';//фикс. места
include('files/path.php');
include('files/gzips.php');
include($path.'files/db.php');
include($path.'files/auth.php');
include($path.'files/func.php');
going();
place_city();
place_okr();
ryd();
include($path.'files/core.php');
if($_GET[mod]==taran or $_GET[mod]==ok){
$header=TRUE;
}else{
$textl='Замок';
}
include($path.'files/head.php');
include($path.'files/zag.php');
$timer=time()+180;
////////////////////////
$random=rand(1000,9999);
////////////////
$req = mysql_query("SELECT * FROM `zamok` WHERE `city` = '$udata[city]'");
$zamok = mysql_fetch_array($req);
switch($_GET[mod]){
default:
echo '<div class="zagolovok"><div class="zagolovok1"> <div class="zagolovok2"><div class="zagolovok_right"></div><div class="zagolovok_left"></div><div class="ch_name">';
echo 'Замок';
echo '</div><div class="clearFix"></div></div></div></div>';
$req = mysql_query("SELECT * FROM `zamok` WHERE `city` = '$udata[city]' LIMIT 1");
////////////////////////////
$avto=mysql_num_rows($req);
if($avto==1){
$city = mysql_fetch_array($req);
if($city[clan]!='not'){
if($zamok[vorota]>0 and $zamok[clan]!=$udata[clan]){
echo '<div class="fon bgray"><div class="bg1"><div class="bg2"><div class="bg3"><div class="bg4"><div class="bg5"><div class="bg6"><div class="bg7"><div class="bg8">';
echo'<center>Прочность ворот: '.$zamok[vorota].'</center><br>';
echo"<center><a href="zamok.php?mod=taran"><input class="buuut" type="submit" value="Бить ворота" /></a></center>";
echo '</div></div></div></div></div></div></div></div></div>';
}else{
#################################
$req = mysql_query("SELECT * FROM `guards` WHERE `city` = '$udata[city]'");
//////////////////////////////
}}
echo '<div class="fon bgray"><div class="bg1"><div class="bg2"><div class="bg3"><div class="bg4"><div class="bg5"><div class="bg6"><div class="bg7"><div class="bg8">';
echo "Внимание! Для захвата Цитадели замка требуется 15<img src='pic/tip/Лунный кристалл.png' height='16' width='16'/>";
echo '</div></div></div></div></div></div></div></div></div>';
if($zamok[clan]==$udata[clan]){
echo '<div class="zagolovok"><div class="zagolovok1"> <div class="zagolovok2"><div class="zagolovok_right"></div><div class="zagolovok_left"></div><div class="ch_name">';
echo'Защита замка: '.$zamok[vorota].'';
echo '</div><div class="clearFix"></div></div></div></div>';
}
While($mob = mysql_fetch_array($req))
{
if($mob[status]==on or $mob[status]==batle){
echo '<div class="fon bgray"><div class="bg1"><div class="bg2"><div class="bg3"><div class="bg4"><div class="bg5"><div class="bg6"><div class="bg7"><div class="bg8">';
echo "<a href="zamok.php?mod=info&id=$mob[id]">$mob[name]</a> <img src='pic/hp.png'/>$mob[hp]/$mob[hpall] <br><img src="pic/tip/$mob[name].png" width="64" height="64"><br><a class="buuut" href="zamok.php?mod=ok&id=$mob[id]">Атаковать</a>";
echo '</div></div></div></div></div></div></div></div></div>';
}
elseif($mob[status]==battle){
$r = mysql_query("SELECT * FROM `tmp_zamok` WHERE `city` = '$udata[city]' AND `usr`='$mob[oponent]' LIMIT 1");
$m = mysql_fetch_array($r);
$d = time();
if(($d>=($m['ltime']+180) and $mob[hp]<=0) or $d>=($m['ltime']+180)){
mysql_query("UPDATE `guards` SET `status`='on',`hp`='$mob[hpall]', `oponent`='not' WHERE `id` = '$mob[id]'");
$req = mysql_query("SELECT * FROM `users` WHERE `usr` = '$mob[oponent]' LIMIT 1");
$mu = mysql_fetch_array($req);
$nloses=$mu[loses]+1;
mysql_query("UPDATE users SET loses = '$nloses',hp='0' WHERE usr = '$mob[oponent]'");//пишем данные в плэера
mysql_query("DELETE FROM `tmp_zamok` WHERE usr='$mob[oponent]'");
mysql_query("DELETE FROM `log` WHERE usr='$mob[oponent]'");
echo"<a href="zamok.php?mod=ok&id=$mob[id]">$mob[name]($mob[hpall]/$mob[hpall])</a> <br/>";
}else{
if($mestouser['city']==$mesto[city] && $cit[city]==$udata[city] && $mesto[x]==$mestouser['x'] && $mesto[y]==$mestouser['y']){
echo"<img src="pic/tip/$mob[name].gif" width="14" height="14"> <a href="zamok.php?mod=info&id=$mob[id]">$mob[name]($mob[hp]/$mob[hpall])</a> против <a href="search.php?nick=$mob[oponent]&go=go">$mob[oponent] </a><br/>";
}
}
}
elseif($mob[status]==off){
$d = time();
if($d>=($mob[oponent]+$mob[time])){
mysql_query("UPDATE `guards` SET `status`='on',`hp`='$mob[hpall]', `oponent`='not' WHERE `id` = '$mob[id]'");
echo"<div class='b-panel gray-panel'> <a href="zamok.php?mod=ok&id=$mob[id]">$mob[name]($mob[hpall]/$mob[hpall])</a></div>";
}else{
echo '<div class="fon bgray"><div class="bg1"><div class="bg2"><div class="bg3"><div class="bg4"><div class="bg5"><div class="bg6"><div class="bg7"><div class="bg8">';
echo" <a href="zamok.php?mod=info&id=$mob[id]">$mob[name]</a><br><img src="pic/tip/$mob[name].png" width="64" height="64"><br><font color='red'>Мёртв</font>";
echo '</div></div></div></div></div></div></div></div></div>';
}
}
}
$req = mysql_query("SELECT * FROM `guards` WHERE `city` = '$udata[city]' AND `status` = 'on' OR `status` = 'battle' ");
$guards=mysql_num_rows($req);
if($guards==0){
echo "<div class='button pad_bot_5 pad'><a href="zamok.php?mod=citadel">    <img src='/theme/standart/images/galochka.png'/> Цитадель</a></div>";
}
}
log_msg($tlog='zamok');
break;
case 'info':
if($zamok[vorota]>0){
header ("Location: zamok.php?");exit;
}
$id=$_GET[id];
$req = mysql_query("SELECT * FROM `guards` WHERE `city` = '$udata[city]' and `id`='".mysql_real_escape_string($_GET['id'])."' LIMIT 1");
////////////////////////////
if (mysql_num_rows($req)==0){echo"Такого стражника не существует.";include($path.'files/down.php');exit;}
$mob = mysql_fetch_array($req);
echo '<div class="zagolovok"><div class="zagolovok1"> <div class="zagolovok2"><div class="zagolovok_right"></div><div class="zagolovok_left"></div><div class="ch_name">';
echo "$mob[name]";
echo '</div><div class="clearFix"></div></div></div></div>';
echo '<div class="fon bgray"><div class="bg1"><div class="bg2"><div class="bg3"><div class="bg4"><div class="bg5"><div class="bg6"><div class="bg7"><div class="bg8">';
echo"<img src="pic/tip/$mob[name].png" width="64" height="64"><br/>";
echo"Уровень: $mob[lvl]<br/>";
echo"Здоровье: $mob[hp]/$mob[hpall]<br/>";
echo"Урон: $mob[umin]/$mob[umax]<br/>";
/*echo"Защита головы: $mob[pgolova]<br/>";
echo"Защита тела: $mob[pbody]<br/>";
echo"Защита ног: $mob[pnogi]<br/>";
echo"Защита от умений: $mob[pmag]<br/>";*/
echo"Ловкость: $mob[lovk]<br/>";
echo"Точность: $mob[krit]%<br/>";
echo"Сокрушение: $mob[ukrit]%<br/>";
echo"Стойкость: $mob[antikrit]%<br/>";
echo"Время смерти (в секундах): $mob[time]";
echo '</div></div></div></div></div></div></div></div></div>';
echo "<div class='button pad_bot_5 pad'><a href="zamok.php?">    <img src='/theme/standart/images/galochka.png'/> Вернуться</a></div>";
break;
case 'taran':
if($zamok[vorota]<=0){
header ("Location: zamok.php?");exit;
}else{
if($udata[lvl]<10){
mysql_query("INSERT INTO log SET usr='$log',text='У вас маленький уровень! Захватить город могут только от 10 уровня!',kto='system',place='zamok',timer='$timer'");
header ("Location: zamok.php?");exit;
}
$uron=rand($udata[umin],$udata[umax])+$udata[sila];
$zamok[vorota]=$zamok[vorota]-$uron;
if($zamok[vorota]<0){$zamok[vorota]=0;}
mysql_query("UPDATE `zamok` SET `vorota` = '$zamok[vorota]' WHERE `city` = '$udata[city]'");
mysql_query("INSERT INTO log SET usr='$log',text='Вы наносите воротам урон $uron',kto='user',place='zamok',timer='$timer'");
header ("Location: zamok.php?");exit;
}
break;
case 'ok':
$time=time();
////////////////////////////////////////////////////////
if($zamok[vorota]>0){
header ("Location: zamok.php?");exit;
}
if ($inaw==1){
require_once'files/head.php';
require_once'files/zag.php';
echo'У вас бой на арене!';
include($path.'files/down.php');
include($path.'files/meny.php');
exit;
}
///////////////
$id='$id';
////////////////////////
$req = mysql_query("SELECT * FROM `guards` WHERE `city` = '$udata[city]' and `id`='".mysql_real_escape_string($_GET['id'])."' LIMIT 1");
////////////////////////////
if (mysql_num_rows($req)==0){
header ("Location: zamok.php?");exit;
}
/////////////////////////////
$mob = mysql_fetch_array($req);
if($mob[status]==battle or $mob[status]==off){
header ("Location: zamok.php?");exit;
}
mysql_query("UPDATE `guards` SET `status` = 'battle', WHERE `city` = '$udata[city]' and `id`='".mysql_real_escape_string($_GET['id'])."' LIMIT 1");
mysql_query("INSERT INTO `tmp_zamok` SET `usr` = '$log',`mob` = '".mysql_real_escape_string($_GET['id'])."',`city` = '$udata[city]',`ltime`='$time'");
del_log($lpl='battle');
mysql_query("INSERT INTO log SET usr='$log',text='$log против $mob[name]!Бой начался!',kto='system',place='battle',timer='$timer'");
header ("Location: fight.php?");exit;
break;
case 'citadel':
$req = mysql_query("SELECT * FROM `clan` WHERE `lider` = '$log'");
////////////////////////////
$lider=mysql_num_rows($req);
if($lider==0){
echo '<div class="fon bgray"><div class="bg1"><div class="bg2"><div class="bg3"><div class="bg4"><div class="bg5"><div class="bg6"><div class="bg7"><div class="bg8">';
echo'Вы не лидер клана!<br/>';
echo '</div></div></div></div></div></div></div></div></div>';
echo "<div class='button pad_bot_5 pad'><a href="zamok.php?">    <img src='/theme/standart/images/galochka.png'/> Вернуться</a></div>";
include($path.'files/down.php');
include($path.'files/meny.php');
exit;
}
if($zamok[vorota]>0){
echo '<div class="fon bgray"><div class="bg1"><div class="bg2"><div class="bg3"><div class="bg4"><div class="bg5"><div class="bg6"><div class="bg7"><div class="bg8">';
echo'Ворота целы!<br/>';
echo '</div></div></div></div></div></div></div></div></div>';
echo "<div class='button pad_bot_5 pad'><a href="zamok.php?">    <img src='/theme/standart/images/galochka.png'/> Вернуться</a></div>";
include($path.'files/down.php');
include($path.'files/meny.php');
exit;
}
$req = mysql_query("SELECT * FROM `guards` WHERE `city` = '$udata[city]' AND `status` = 'on' ");
$guards=mysql_num_rows($req);
if($guards>=1){
echo '<div class="fon bgray"><div class="bg1"><div class="bg2"><div class="bg3"><div class="bg4"><div class="bg5"><div class="bg6"><div class="bg7"><div class="bg8">';
echo'Есть живые стражники!<br/>';
echo '</div></div></div></div></div></div></div></div></div>';
echo "<div class='button pad_bot_5 pad'><a href="zamok.php?">    <img src='/theme/standart/images/galochka.png'/> Вернуться</a></div>";
include($path.'files/down.php');
include($path.'files/meny.php');
exit;
}
if($_GET[act]!='zahvat'){
echo"<div class='button pad_bot_5 pad'><a href="zamok.php?mod=citadel&act=zahvat">    <img src='/theme/standart/images/galochka.png'/> Захватить город!!!</a></div>";
}else{
if($zamok[clan]==$udata[clan]){
echo '<div class="fon bgray"><div class="bg1"><div class="bg2"><div class="bg3"><div class="bg4"><div class="bg5"><div class="bg6"><div class="bg7"><div class="bg8">';
echo'Этот замок принадлежить Вашему клану!<br/>';
echo '</div></div></div></div></div></div></div></div></div>';
echo "<div class='button pad_bot_5 pad'><a href="zamok.php?">    <img src='/theme/standart/images/galochka.png'/> Вернуться</a></div>";
include($path.'files/down.php');
include($path.'files/meny.php');
exit;
}
$req = mysql_query("SELECT * FROM `res` WHERE `lat_name` = 'luniy_kristal' AND `kol` >= '$zamok[kristals]' AND `usr` = '$log'");
$kristals=mysql_num_rows($req);
if($kristals==0){
echo '<div class="fon bgray"><div class="bg1"><div class="bg2"><div class="bg3"><div class="bg4"><div class="bg5"><div class="bg6"><div class="bg7"><div class="bg8">';
echo'НЕ хватает Лунный кристаллов!<br/>';
echo '</div></div></div></div></div></div></div></div></div>';
echo "<div class='button pad_bot_5 pad'><a href="zamok.php?">    <img src='/theme/standart/images/galochka.png'/> Вернуться</a></div>";
include($path.'files/down.php');
include($path.'files/meny.php');
exit;
}
$kristal = mysql_fetch_array($req);
if($kristal[kol]-$zamok[kristals]==0){
mysql_query("DELETE FROM `res` WHERE `usr`='$log' and `lat_name` = 'luniy_kristal'");
}else{
$kristal[kol]=$kristal[kol]-$zamok[kristals];
mysql_query("UPDATE `res` SET `kol` = '$kristal[kol]' WHERE `usr`='$log' and `lat_name` = 'luniy_kristal'");
}
mysql_query("UPDATE `zamok` SET `clan` = '$udata[clan]' WHERE `city`='$udata[city]'");
echo '<div class="fon bgray"><div class="bg1"><div class="bg2"><div class="bg3"><div class="bg4"><div class="bg5"><div class="bg6"><div class="bg7"><div class="bg8">';
echo"Замок $zamok[name] захвачен вашим кланом!<br/>";
echo '</div></div></div></div></div></div></div></div></div>';
echo "<div class='button pad_bot_5 pad'><a href="zamok.php?">    <img src='/theme/standart/images/galochka.png'/> Вернуться</a></div>";
}
break;
}
include($path.'files/down.php');
include($path.'files/meny.php');
?>