Файл: www/location.php
Строк: 567
<?php
include 'inc/mysql.php';
include 'inc/check.php';
include 'inc/functions.php';
top();
include 'inc/account.php';
include 'inc/interface.php';
if(isset($_SESSION['auth']) && $_SESSION['auth']==1){
$location=mysql_fetch_array(mysql_query("SELECT * FROM `location` WHERE `y`='".$account['y']."' AND `x`='".$account['x']."'"));
if(isset($_GET['npc']) && is_numeric($_GET['npc'])){
$npc=intval($_GET['npc']);
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `npc` WHERE `id`='".$npc."' AND `x`='".$location['x']."' AND `y`='".$location['y']."'"),0)){
$npc=mysql_fetch_array(mysql_query("SELECT * FROM `npc` WHERE `id`='".$npc."' AND `x`='".$location['x']."' AND `y`='".$location['y']."'"));
echo $npc['name'];
echo '<br />';
if (isset($_GET['talk']) && is_numeric($_GET['talk'])){
$talk=intval($_GET['talk']);
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `dialogs` WHERE `npc`='".$npc['id']."' AND `id`='".$talk."'"),0)){
$talk=mysql_fetch_array(mysql_query("SELECT * FROM `dialogs` WHERE `npc`='".$npc['id']."' AND `id`='".$talk."'"));
if ($talk['quest_need_complete']){
if (!mysql_result(mysql_query("SELECT COUNT(*) FROM `quests` WHERE `quest`='".$talk['quest_need_complete']."' AND `account`='".$account['id']."' AND `completed`='1' AND `complet`='0'"),0)){
header("Location: ?npc=".$npc['id']);
exit;
}
}
if ($talk['quest_completed']){
if (!mysql_result(mysql_query("SELECT COUNT(*) FROM `quests` WHERE `quest`='".$talk['quest_completed']."' AND `account`='".$account['id']."' AND `completed`='1' AND `complet`='0'"),0)){
header("Location: ?npc=".$npc['id']);
exit;
}else{
mysql_query("UPDATE `quests` SET `complet`='1' WHERE `quest`='".$talk['quest_completed']."' AND `account`='".$account['id']."'");
}
}
if ($talk['quest_need']){
if (!mysql_result(mysql_query("SELECT COUNT(*) FROM `quests` WHERE `quest`='".$talk['quest_need']."' AND `account`='".$account['id']."'"),0)){
header("Location: ?npc=".$npc['id']);
exit;
}
}
if ($talk['questd']){
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `quests` WHERE `quest`='".$talk['questd']."' AND `account`='".$account['id']."'"),0)){
header("Location: ?npc=".$npc['id']);
exit;
}
}
if ($talk['quest']){
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `quests` WHERE `quest`='".$talk['quest']."' AND `account`='".$account['id']."'"),0)){
header("Location: ?npc=".$npc['id']);
exit;
}else{
$quest=mysql_fetch_array(mysql_query("SELECT * FROM `quest` WHERE `id`='".$talk['quest']."'"));
mysql_query("INSERT INTO `quests`(`quest`,`account`,`kill_mob`,`kill_mob_col`,`task`,`task_with`,`res_need`,`res_need_col`,`complet`,`complete_npc`) VALUES ('".$quest['id']."','".$account['id']."','".$quest['kill_mob']."','".$quest['kill_mob_col']."','".$quest['task']."','".$quest['task_with']."','".$quest['res_need']."','".$quest['res_need_col']."','0','".$talk['quest_npc_complete']."')");
}
}
echo '<img src="/data/img/units/npc/'.$npc['icon'].'.jpg" style="float:left;"><font color="#8e8171">'.$talk['talk_otvet_npc'].'</font><br />';
$resd=mysql_query("SELECT * FROM `dialogs` WHERE `npc`='".$npc['id']."' AND `talk_id_ref`='".$talk['id']."'");
while($result=mysql_fetch_array($resd)){
echo '<a href="?npc='.$npc['id'].'&talk='.$result['id'].'">'.$result['talk_name'].'</a>';
}
exit;
}
}
echo '<img src="/data/img/units/npc/'.$npc['icon'].'.jpg" style="float:left;" width="36px" height="36px"><font color="#8e8171">'.$npc['talk'].'</font><br />';
$resd=mysql_query("SELECT * FROM `dialogs` WHERE `npc`='".$npc['id']."'");
while($result=mysql_fetch_array($resd)){
if (!$result['talk_id_ref']){
if ($result['questd']){
if ($result['quest_need_complete']){
if (!mysql_result(mysql_query("SELECT COUNT(*) FROM `quests` WHERE `quest`='".$result['quest_need_complete']."' AND `account`='".$account['id']."' AND `completed`='1'"),0)){
}else{
echo '<a href="?npc='.$npc['id'].'&talk='.$result['id'].'">'.$result['talk_name'].'</a><br />';
}
}elseif (mysql_result(mysql_query("SELECT COUNT(*) FROM `quests` WHERE `quest`='".$result['questd']."' AND `account`='".$account['id']."'"),0)){
}else{
echo '<a href="?npc='.$npc['id'].'&talk='.$result['id'].'">'.$result['talk_name'].'</a><br />';
}
}elseif($result['quest_need']){
if ($result['quest_completed']){
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `quests` WHERE `quest`='".$result['quest_need']."' AND `completed`='1' AND `complet`='0' AND `account`='".$account['id']."'"),0)){
echo '<a href="?npc='.$npc['id'].'&talk='.$result['id'].'">'.$result['talk_name'].'</a><br />';
}else{
}
}
}elseif($result['quest_need_complete']){
if (!mysql_result(mysql_query("SELECT COUNT(*) FROM `quests` WHERE `quest`='".$result['quest_need_complete']."' AND `account`='".$account['id']."' AND `completed`='1' AND `complet`='0'"),0)){
}else{
echo '<a href="?npc='.$npc['id'].'&talk='.$result['id'].'">'.$result['talk_name'].'</a><br />';
}
}else{
echo '<a href="?npc='.$npc['id'].'&talk='.$result['id'].'">'.$result['talk_name'].'</a><br />';
}
}
}
exit;
}else{
header("Location: ?");
exit;
}
}
if (isset($_GET['x1']) && isset($_GET['y1']) && is_numeric($_GET['x1']) && is_numeric($_GET['y1'])){
$x1=intval($_GET['x1']);
$y1=intval($_GET['y1']);
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `mobs` WHERE `x`='".$location['x']."' AND `y`='".$location['y']."' AND `x1`='".$x1."' AND `y1`='".$y1."'"),0)){
$mob=mysql_fetch_array(mysql_query("SELECT * FROM `mobs` WHERE `x`='".$location['x']."' AND `y`='".$location['y']."' AND `x1`='".$x1."' AND `y1`='".$y1."'"));
}
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `npc` WHERE `x`='".$location['x']."' AND `y`='".$location['y']."' AND `x1`='".$x1."' AND `y1`='".$y1."'"),0)){
$npc=mysql_fetch_array(mysql_query("SELECT * FROM `mobs` WHERE `x`='".$location['x']."' AND `y`='".$location['y']."' AND `x1`='".$x1."' AND `y1`='".$y1."'"));
}
if (!isset($mob) && !isset($npc)){
if ($account['x1']+1==$x1 && $account['y1']==$y1){
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `sublocation` WHERE `x`='".$account['x']."' AND `y`='".$account['y']."' AND `x1`='".$x1."' AND `y1`='".$y1."' AND `notgo`='1'"),0)){
mysql_query("UPDATE `account` SET `x1`='".$x1."',`y1`='".$y1."' WHERE `id`='".$account['id']."'");
}
if (mysql_result(mysql_query("SELECT `x_tp` FROM `sublocation` WHERE
`x`='".$account['x']."'
AND `y`='".$account['y']."'
AND `x1`='".$x1."'
AND `y1`='".$y1."'"),0)){
$loctp=mysql_fetch_assoc(mysql_query("SELECT * FROM `sublocation` WHERE
`x`='".$account['x']."'
AND `y`='".$account['y']."'
AND `x1`='".$x1."'
AND `y1`='".$y1."'"));
mysql_query("UPDATE `account` SET
`x`='".$loctp['x_tp']."',
`y`='".$loctp['y_tp']."',
`x1`='".$loctp['x1_tp']."',
`y1`='".$loctp['y1_tp']."'
WHERE
`id`='".$account['id']."'
");
}
header("Location: ?");
exit;
}elseif ($account['x1']-1==$x1 && $account['y1']==$y1){
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `sublocation` WHERE `x`='".$account['x']."' AND `y`='".$account['y']."' AND `x1`='".$x1."' AND `y1`='".$y1."' AND `notgo`='1'"),0)){
mysql_query("UPDATE `account` SET `x1`='".$x1."',`y1`='".$y1."' WHERE `id`='".$account['id']."'");
}
if (mysql_result(mysql_query("SELECT `x_tp` FROM `sublocation` WHERE
`x`='".$account['x']."'
AND `y`='".$account['y']."'
AND `x1`='".$x1."'
AND `y1`='".$y1."'"),0)){
$loctp=mysql_fetch_assoc(mysql_query("SELECT * FROM `sublocation` WHERE
`x`='".$account['x']."'
AND `y`='".$account['y']."'
AND `x1`='".$x1."'
AND `y1`='".$y1."'"));
mysql_query("UPDATE `account` SET
`x`='".$loctp['x_tp']."',
`y`='".$loctp['y_tp']."',
`x1`='".$loctp['x1_tp']."',
`y1`='".$loctp['y1_tp']."'
WHERE
`id`='".$account['id']."'
");
}
header("Location: ?");
exit;
}elseif ($account['y1']+1==$y1 && $account['x1']==$x1){
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `sublocation` WHERE `x`='".$account['x']."' AND `y`='".$account['y']."' AND `x1`='".$x1."' AND `y1`='".$y1."' AND `notgo`='1'"),0)){
mysql_query("UPDATE `account` SET `x1`='".$x1."',`y1`='".$y1."' WHERE `id`='".$account['id']."'");
}
if (mysql_result(mysql_query("SELECT `x_tp` FROM `sublocation` WHERE
`x`='".$account['x']."'
AND `y`='".$account['y']."'
AND `x1`='".$x1."'
AND `y1`='".$y1."'"),0)){
$loctp=mysql_fetch_assoc(mysql_query("SELECT * FROM `sublocation` WHERE
`x`='".$account['x']."'
AND `y`='".$account['y']."'
AND `x1`='".$x1."'
AND `y1`='".$y1."'"));
mysql_query("UPDATE `account` SET
`x`='".$loctp['x_tp']."',
`y`='".$loctp['y_tp']."',
`x1`='".$loctp['x1_tp']."',
`y1`='".$loctp['y1_tp']."'
WHERE
`id`='".$account['id']."'
");
}
header("Location: ?");
exit;
}elseif ($account['y1']-1==$y1 && $account['x1']==$x1){
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `sublocation` WHERE `x`='".$account['x']."' AND `y`='".$account['y']."' AND `x1`='".$x1."' AND `y1`='".$y1."' AND `notgo`='1'"),0)){
mysql_query("UPDATE `account` SET `x1`='".$x1."',`y1`='".$y1."' WHERE `id`='".$account['id']."'");
}
if (mysql_result(mysql_query("SELECT `x_tp` FROM `sublocation` WHERE
`x`='".$account['x']."'
AND `y`='".$account['y']."'
AND `x1`='".$x1."'
AND `y1`='".$y1."'"),0)){
$loctp=mysql_fetch_assoc(mysql_query("SELECT * FROM `sublocation` WHERE
`x`='".$account['x']."'
AND `y`='".$account['y']."'
AND `x1`='".$x1."'
AND `y1`='".$y1."'"));
mysql_query("UPDATE `account` SET
`x`='".$loctp['x_tp']."',
`y`='".$loctp['y_tp']."',
`x1`='".$loctp['x1_tp']."',
`y1`='".$loctp['y1_tp']."'
WHERE
`id`='".$account['id']."'
");
}
header("Location: ?");
exit;
}elseif ($account['y1']+1==$y1 && $account['x1']+1==$x1){
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `sublocation` WHERE `x`='".$account['x']."' AND `y`='".$account['y']."' AND `x1`='".$x1."' AND `y1`='".$y1."' AND `notgo`='1'"),0)){
mysql_query("UPDATE `account` SET `x1`='".$x1."',`y1`='".$y1."' WHERE `id`='".$account['id']."'");
}
if (mysql_result(mysql_query("SELECT `x_tp` FROM `sublocation` WHERE
`x`='".$account['x']."'
AND `y`='".$account['y']."'
AND `x1`='".$x1."'
AND `y1`='".$y1."'"),0)){
$loctp=mysql_fetch_assoc(mysql_query("SELECT * FROM `sublocation` WHERE
`x`='".$account['x']."'
AND `y`='".$account['y']."'
AND `x1`='".$x1."'
AND `y1`='".$y1."'"));
mysql_query("UPDATE `account` SET
`x`='".$loctp['x_tp']."',
`y`='".$loctp['y_tp']."',
`x1`='".$loctp['x1_tp']."',
`y1`='".$loctp['y1_tp']."'
WHERE
`id`='".$account['id']."'
");
}
header("Location: ?");
exit;
}elseif ($account['y1']+1==$y1 && $account['x1']-1==$x1){
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `sublocation` WHERE `x`='".$account['x']."' AND `y`='".$account['y']."' AND `x1`='".$x1."' AND `y1`='".$y1."' AND `notgo`='1'"),0)){
mysql_query("UPDATE `account` SET `x1`='".$x1."',`y1`='".$y1."' WHERE `id`='".$account['id']."'");
}
if (mysql_result(mysql_query("SELECT `x_tp` FROM `sublocation` WHERE
`x`='".$account['x']."'
AND `y`='".$account['y']."'
AND `x1`='".$x1."'
AND `y1`='".$y1."'"),0)){
$loctp=mysql_fetch_assoc(mysql_query("SELECT * FROM `sublocation` WHERE
`x`='".$account['x']."'
AND `y`='".$account['y']."'
AND `x1`='".$x1."'
AND `y1`='".$y1."'"));
mysql_query("UPDATE `account` SET
`x`='".$loctp['x_tp']."',
`y`='".$loctp['y_tp']."',
`x1`='".$loctp['x1_tp']."',
`y1`='".$loctp['y1_tp']."'
WHERE
`id`='".$account['id']."'
");
}
header("Location: ?");
exit;
}elseif ($account['y1']-1==$y1 && $account['x1']-1==$x1){
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `sublocation` WHERE `x`='".$account['x']."' AND `y`='".$account['y']."' AND `x1`='".$x1."' AND `y1`='".$y1."' AND `notgo`='1'"),0)){
mysql_query("UPDATE `account` SET `x1`='".$x1."',`y1`='".$y1."' WHERE `id`='".$account['id']."'");
}
if (mysql_result(mysql_query("SELECT `x_tp` FROM `sublocation` WHERE
`x`='".$account['x']."'
AND `y`='".$account['y']."'
AND `x1`='".$x1."'
AND `y1`='".$y1."'"),0)){
$loctp=mysql_fetch_assoc(mysql_query("SELECT * FROM `sublocation` WHERE
`x`='".$account['x']."'
AND `y`='".$account['y']."'
AND `x1`='".$x1."'
AND `y1`='".$y1."'"));
mysql_query("UPDATE `account` SET
`x`='".$loctp['x_tp']."',
`y`='".$loctp['y_tp']."',
`x1`='".$loctp['x1_tp']."',
`y1`='".$loctp['y1_tp']."'
WHERE
`id`='".$account['id']."'
");
}
header("Location: ?");
exit;
}elseif ($account['y1']-1==$y1 && $account['x1']+1==$x1){
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `sublocation` WHERE `x`='".$account['x']."' AND `y`='".$account['y']."' AND `x1`='".$x1."' AND `y1`='".$y1."' AND `notgo`='1'"),0)){
mysql_query("UPDATE `account` SET `x1`='".$x1."',`y1`='".$y1."' WHERE `id`='".$account['id']."'");
}
if (mysql_result(mysql_query("SELECT `x_tp` FROM `sublocation` WHERE
`x`='".$account['x']."'
AND `y`='".$account['y']."'
AND `x1`='".$x1."'
AND `y1`='".$y1."'"),0)){
$loctp=mysql_fetch_assoc(mysql_query("SELECT * FROM `sublocation` WHERE
`x`='".$account['x']."'
AND `y`='".$account['y']."'
AND `x1`='".$x1."'
AND `y1`='".$y1."'"));
mysql_query("UPDATE `account` SET
`x`='".$loctp['x_tp']."',
`y`='".$loctp['y_tp']."',
`x1`='".$loctp['x1_tp']."',
`y1`='".$loctp['y1_tp']."'
WHERE
`id`='".$account['id']."'
");
}
header("Location: ?");
exit;
}
}
}
if (isset($_GET['attack']) && is_numeric($_GET['attack'])){
$attack=intval($_GET['attack']);
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `mobs` WHERE `id`='".$attack."' AND `x`='".$location['x']."' AND `y`='".$location['y']."'"),0)){
$attack=mysql_fetch_array(mysql_query("SELECT * FROM `mobs` WHERE `id`='".$attack."' AND `x`='".$location['x']."' AND `y`='".$location['y']."'"));
if (time()-$attack['last_death']<$attack['death_time']){
header("Location: ?");
exit;
}
mysql_query("INSERT INTO `battle` (`x`,`y`,`x1`,`y1`) VALUES ('".$location['x']."','".$location['y']."','".$x1."','".$y1."')");
$battle=mysql_insert_id();
mysql_query("DELETE FROM `battle_log` WHERE `account`='".$account['id']."'");
mysql_query("INSERT INTO `battle_log`(`account`,`mess`)VALUES('".$account['id']."','<font color="#8e8171">Бой начался!</font>')");
mysql_query("UPDATE `account` SET `battle`='".$battle."',`battle_attack`='".$attack['id']."',`battle_target_type`='mob' WHERE `id`='".$account['id']."'");
mysql_query("UPDATE `mobs` SET `battle`='".$battle."',`last_damag`='".time()."',`hp`='".$attack['max_hp']."' WHERE
`id`='".$attack['id']."'");
$qat=mysql_query("SELECT * FROM `mobs` WHERE
`x`='".$attack['x']."'
AND `y`='".$attack['y']."'
AND (
(`x1`='".($attack['x1']+1)."' AND `y1`='".$attack['y1']."')
OR (`x1`='".$attack['x1']."' AND `y1`='".($attack['y1']+1)."')
OR (`x1`='".($attack['x1']+1)."' AND `y1`='".($attack['y1']+1)."')
OR (`x1`='".($attack['x1']-1)."' AND `y1`='".$attack['y1']."')
OR (`x1`='".$attack['x1']."' AND `y1`='".($attack['y1']-1)."')
OR (`x1`='".($attack['x1']-1)."' AND `y1`='".($attack['y1']-1)."')
OR (`x1`='".($attack['x1']-1)."' AND `y1`='".($attack['y1']+1)."')
OR (`x1`='".($attack['x1']+1)."' AND `y1`='".($attack['y1']-1)."'))
AND `battle`=''");
while($alltargets=mysql_fetch_assoc($qat)){
if (time()-$alltargets['last_death']>=$alltargets['death_time']){
mysql_query("UPDATE `mobs` SET
`last_damag`='".time()."',
`battle`='".$battle."',
`hp`='".$alltargets['max_hp']."'
WHERE
`id`='".$alltargets['id']."'");
}
}
header("Location: /battle.php?");
exit;
}
}
$account['x1']=mysql_result(mysql_query("SELECT `x1` FROM `account` WHERE `id`='".$account['id']."'"),0);
$account['y1']=mysql_result(mysql_query("SELECT `y1` FROM `account` WHERE `id`='".$account['id']."'"),0);
echo $location['name'];
echo '<br />';
echo '<div style="background:url(data/img/location/locs/'.$location['img'].'.png);width:200px;height:200px;">';
echo '<table width="100%" height="100%><tr height="18px">';
$x1=1;
$y1=1;
for($i=0;$i<100;$i++){
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `sublocation` WHERE `x1`='".$x1."' AND `y1`='".$y1."' AND `x`='".$location['x']."' AND `y`='".$location['y']."'"),0)){
$sublocation=mysql_fetch_array(mysql_query("SELECT * FROM `sublocation` WHERE `x1`='".$x1."' AND `y1`='".$y1."' AND `x`='".$location['x']."' AND `y`='".$location['y']."'"));
$title=$sublocation['name'];
$class=NULL;
$style=NULL;
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `mobs` WHERE `x`='".$location['x']."' AND `y`='".$location['y']."' AND `x1`='".$x1."' AND `y1`='".$y1."'"),0)){
$mob=mysql_fetch_array(mysql_query("SELECT * FROM `mobs` WHERE `x`='".$location['x']."' AND `y`='".$location['y']."' AND `x1`='".$x1."' AND `y1`='".$y1."'"));
$title=$mob['name'];
if (time()-$mob['last_death']<$mob['death_time']){
$style="max-width:16px; max-height:16px; background:url(data/userlocdeath.png) no-repeat center;";
}elseif($mob['agrored']==NULL){
$style="max-width:16px; max-height:16px; background:url(data/userlocyello.png) no-repeat center;";
}else{
$style="max-width:16px; max-height:16px; background:url(data/userlocred.png) no-repeat center;";
}
}
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `npc` WHERE `x`='".$location['x']."' AND `y`='".$location['y']."' AND `x1`='".$x1."' AND `y1`='".$y1."'"),0)){
$npc=mysql_fetch_array(mysql_query("SELECT * FROM `npc` WHERE `x`='".$location['x']."' AND `y`='".$location['y']."' AND `x1`='".$x1."' AND `y1`='".$y1."'"));
$title=$npc['name'];
$style="max-width:16px; max-height:16px; background:url(data/userlocblue.png) no-repeat center;";
}
if ($account['x1']==$x1 && $account['y1']==$y1){
$title='Вы';
$style="max-width:16px; max-height:16px; background:url(data/userloc.png) no-repeat center;";
$class=$account['class'];
}
echo '<td width="16px" style="/*border:1px solid black;*/ padding:0px;margin:0px; '.$style.'" title="'.$title.'">';
if (!isset($mob) && !isset($npc)){
if(mysql_result(mysql_query("SELECT COUNT(*) FROM `sublocation` WHERE `x`='".$location['x']."' AND `y`='".$location['y']."' AND `x1`='".($account['x1']+1)."' AND `y1`='".$account['y1']."' AND `notgo`='1'"),0)){//Перемещение вправо
//влево
if ($account['x1']+1==$x1 && $account['y1']==$y1)echo '<a style="border:1px solid green;" href="?x1='.($account['x1']+1).'&y1='.$account['y1'].'"><img src="/data/lochref.png"></a>';
}
if(mysql_result(mysql_query("SELECT COUNT(*) FROM `sublocation` WHERE `x`='".$location['x']."' AND `y`='".$location['y']."' AND `x1`='".($account['x1']-1)."' AND `y1`='".$account['y1']."' AND `notgo`='1'"),0)){//Перемещение влево
//вправо
if ($account['x1']-1==$x1 && $account['y1']==$y1)echo '<a style="border:1px solid green;" href="?x1='.($account['x1']-1).'&y1='.$account['y1'].'"><img src="/data/lochref.png"></a>';
}
if(mysql_result(mysql_query("SELECT COUNT(*) FROM `sublocation` WHERE `x`='".$location['x']."' AND `y`='".$location['y']."' AND `x1`='".$account['x1']."' AND `y1`='".($account['y1']+1)."' AND `notgo`='1'"),0)){//Перемещение вниз
//вниз
if ($account['y1']+1==$y1 && $account['x1']==$x1)echo '<a style="border:1px solid green;" href="?x1='.$account['x1'].'&y1='.($account['y1']+1).'"><img src="/data/lochref.png"></a>';
}
if(mysql_result(mysql_query("SELECT COUNT(*) FROM `sublocation` WHERE `x`='".$location['x']."' AND `y`='".$location['y']."' AND `x1`='".$account['x1']."' AND `y1`='".($account['y1']-1)."' AND `notgo`='1'"),0)){//Перемещение вверх
//вверх
if ($account['y1']-1==$y1 && $account['x1']==$x1)echo '<a style="border:1px solid green;" href="?x1='.$account['x1'].'&y1='.($account['y1']-1).'"><img src="/data/lochref.png"></a>';
}
if(mysql_result(mysql_query("SELECT COUNT(*) FROM `sublocation` WHERE `x`='".$location['x']."' AND `y`='".$location['y']."' AND `x1`='".($account['x1']+1)."' AND `y1`='".($account['y1']+1)."' AND `notgo`='1'"),0)){//Перемещение вверх
//вниз вправо
if ($account['y1']+1==$y1 && $account['x1']+1==$x1)echo '<a style="border:1px solid green;" href="?x1='.($account['x1']+1).'&y1='.($account['y1']+1).'"><img src="/data/lochref.png"></a>';
}
if(mysql_result(mysql_query("SELECT COUNT(*) FROM `sublocation` WHERE `x`='".$location['x']."' AND `y`='".$location['y']."' AND `x1`='".($account['x1']-1)."' AND `y1`='".($account['y1']+1)."' AND `notgo`='1'"),0)){//Перемещение вверх
//вниз влево
if ($account['y1']+1==$y1 && $account['x1']-1==$x1)echo '<a style="border:1px solid green;" href="?x1='.($account['x1']-1).'&y1='.($account['y1']+1).'"><img src="/data/lochref.png"></a>';
}
if(mysql_result(mysql_query("SELECT COUNT(*) FROM `sublocation` WHERE `x`='".$location['x']."' AND `y`='".$location['y']."' AND `x1`='".($account['x1']+1)."' AND `y1`='".($account['y1']-1)."' AND `notgo`='1'"),0)){//Перемещение вверх
//вверх вправо
if ($account['y1']-1==$y1 && $account['x1']+1==$x1)echo '<a style="border:1px solid green;" href="?x1='.($account['x1']+1).'&y1='.($account['y1']-1).'"><img src="/data/lochref.png"></a>';
}
if(mysql_result(mysql_query("SELECT COUNT(*) FROM `sublocation` WHERE `x`='".$location['x']."' AND `y`='".$location['y']."' AND `x1`='".($account['x1']-1)."' AND `y1`='".($account['y1']-1)."' AND `notgo`='1'"),0)){//Перемещение вверх
//вверх влево
if ($account['y1']-1==$y1 && $account['x1']-1==$x1)echo '<a style="border:1px solid green;" href="?x1='.($account['x1']-1).'&y1='.($account['y1']-1).'"><img src="/data/lochref.png"></a>';
}
}
echo '</td>';
$x1++;
}else{
//echo '<td width="16px" height="20px" style="border:1px solid red;margin:0px;padding:0px; padding:0px;margin:0px;" title="'.$x1.'">'.$y1.'</td>';
echo '<td width="16px" style="/*border:1px solid red;*/ padding:0px;margin:0px;" title="'.$location['name'].'"></td>';
$x1++;
}
if ($i==9){
$y1=$y1+1;
$x1=1;
echo '</tr><tr height="18px">';
}elseif($i==19){
$y1=$y1+1;
$x1=1;
echo '</tr><tr height="18px">';
}elseif($i==29){
echo '</tr><tr height="18px">';
$y1=$y1+1;
$x1=1;
}elseif($i==39){
echo '</tr><tr height="18px">';
$y1=$y1+1;
$x1=1;
}elseif($i==49){
echo '</tr><tr height="18px">';
$y1=$y1+1;
$x1=1;
}elseif($i==59){
echo '</tr><tr height="18px">';
$y1=$y1+1;
$x1=1;
}elseif($i==69){
echo '</tr><tr height="18px">';
$y1=$y1+1;
$x1=1;
}elseif($i==79){
echo '</tr><tr height="18px">';
$y1=$y1+1;
$x1=1;
}elseif($i==89){
echo '</tr><tr height="17px">';
$y1=$y1+1;
$x1=1;
}elseif($i==100){
echo '</tr>';
$y1=$y1+1;
$x1=1;
}
unset($mob);
unset($npc);
}
echo '</table>';
echo '</div>';
if (mysql_num_rows(mysql_query("SELECT * FROM `mobs` WHERE (`x1`='".($account['x1']+1)."' AND `y1`='".$account['y1']."')
OR (`x1`='".($account['x1']+1)."' AND `y1`='".($account['y1']+1)."')
OR (`x1`='".($account['x1']-1)."' AND `y1`='".$account['y1']."')
OR (`x1`='".($account['x1']-1)."' AND `y1`='".($account['y1']-1)."')
OR (`x1`='".$account['x1']."' AND `y1`='".($account['y1']+1)."')
OR (`x1`='".($account['x1']-1)."' AND `y1`='".($account['y1']+1)."')
OR (`x1`='".$account['x1']."' AND `y1`='".($account['y1']-1)."')
OR (`x1`='".($account['x1']+1)."' AND `y1`='".($account['y1']-1)."')
OR (`x1`='".($account['x1']-1)."' AND `y1`='".$account['y1']."')
AND `x`='".$location['x']."' AND `y`='".$location['y']."'
")) OR mysql_num_rows(mysql_query("SELECT * FROM `npc` WHERE (`x1`='".($account['x1']+1)."' AND `y1`='".$account['y1']."')
OR (`x1`='".($account['x1']+1)."' AND `y1`='".($account['y1']+1)."')
OR (`x1`='".($account['x1']-1)."' AND `y1`='".$account['y1']."')
OR (`x1`='".($account['x1']-1)."' AND `y1`='".($account['y1']-1)."')
OR (`x1`='".$account['x1']."' AND `y1`='".($account['y1']+1)."')
OR (`x1`='".($account['x1']-1)."' AND `y1`='".($account['y1']+1)."')
OR (`x1`='".$account['x1']."' AND `y1`='".($account['y1']-1)."')
OR (`x1`='".($account['x1']+1)."' AND `y1`='".($account['y1']-1)."')
OR (`x1`='".($account['x1']-1)."' AND `y1`='".$account['y1']."')
AND `x`='".$location['x']."' AND `y`='".$location['y']."'
"))){
echo 'Кто рядом:<br />';
//Мобы
$resm=mysql_query("SELECT * FROM `mobs` WHERE (`x1`='".($account['x1']+1)."' AND `y1`='".$account['y1']."')
OR (`x1`='".($account['x1']+1)."' AND `y1`='".($account['y1']+1)."')
OR (`x1`='".($account['x1']-1)."' AND `y1`='".$account['y1']."')
OR (`x1`='".($account['x1']-1)."' AND `y1`='".($account['y1']-1)."')
OR (`x1`='".$account['x1']."' AND `y1`='".($account['y1']+1)."')
OR (`x1`='".($account['x1']-1)."' AND `y1`='".($account['y1']+1)."')
OR (`x1`='".$account['x1']."' AND `y1`='".($account['y1']-1)."')
OR (`x1`='".($account['x1']+1)."' AND `y1`='".($account['y1']-1)."')
OR (`x1`='".($account['x1']-1)."' AND `y1`='".$account['y1']."')
AND `x`='".$location['x']."' AND `y`='".$location['y']."'
");
while($resultm=mysql_fetch_array($resm)){
echo '<img src="/data/img/units/mobs/'.$resultm['icon'].'.jpg" width="15px" height="15px">'.$resultm['name'];
if (time()-$resultm['last_death']<$resultm['death_time']){
echo ' (мертв)';
}else{
echo '<a href="?attack='.$resultm['id'].'"> Атаковать</a>';
}
echo '<br />';
}
//НПЦ
$resn=mysql_query("SELECT * FROM `npc` WHERE (`x1`='".($account['x1']+1)."' AND `y1`='".$account['y1']."')
OR (`x1`='".($account['x1']+1)."' AND `y1`='".($account['y1']+1)."')
OR (`x1`='".($account['x1']-1)."' AND `y1`='".$account['y1']."')
OR (`x1`='".($account['x1']-1)."' AND `y1`='".($account['y1']-1)."')
OR (`x1`='".$account['x1']."' AND `y1`='".($account['y1']+1)."')
OR (`x1`='".($account['x1']-1)."' AND `y1`='".($account['y1']+1)."')
OR (`x1`='".$account['x1']."' AND `y1`='".($account['y1']-1)."')
OR (`x1`='".($account['x1']+1)."' AND `y1`='".($account['y1']-1)."')
OR (`x1`='".($account['x1']-1)."' AND `y1`='".$account['y1']."')
AND `x`='".$location['x']."' AND `y`='".$location['y']."'
");
while($result=mysql_fetch_array($resn)){
echo '<img src="/data/img/units/npc/'.$result['icon'].'.jpg" width="15px" height="15px">'.$result['name'];
echo '<a href="?npc='.$result['id'].'"> Поговорить</a>';
echo '<br />';
}
}
if (!isset($resm) && !isset($resn)){
echo 'Рядом никого нет';
}
}else{
header ("Location: /?");
exit;
}
down();
?>