Файл: gamele.ru/includes/get_id.php
Строк: 315
<?php
if($_GET['get_id'] == '5' and in_array($_GET['vcode'],$_SESSION['vcodes'])){// Лаберинт
if($pers['loc'] == 62){
list($pers['x'],$pers['y']) = explode('_', $pers['pos']);
switch($_GET['act']){
case'0':
$GetMove = mysql_fetch_assoc(mysql_query("SELECT * FROM `labyrinth` WHERE `x`='".($pers['x'])."' and `y`='".($pers['y'])."'"));
if($GetMove['L_img'] == 11){
mysql_query("UPDATE `user` SET `pos`='".($pers['x'])."_".($pers['y']-1)."',`wait`='".(time()+10)."' WHERE `id`='".$pers['id']."'");
$pers['pos'] = ($pers['x'])."_".($pers['y']-1);
$pers['wait'] = time()+10;
}
break;
case'10':
$GetMove = mysql_fetch_assoc(mysql_query("SELECT * FROM `labyrinth` WHERE `x`='".($pers['x'])."' and `y`='".($pers['y'])."'"));
if($pers['wait']<time()){
if($GetMove['L_img'] == '3' or $GetMove['L_img'] == '8' or $GetMove['L_img'] == '9'){
if(!empty($GetMove) and $GetMove['d_to'] != '0_0'){
if($GetMove['L_img'] == '3'){
list($d_to['x'],$d_to['y']) = explode('_', $GetMove['d_to']);
$GetDoor = mysql_fetch_assoc(mysql_query("SELECT * FROM `labyrinth` WHERE `x`='".($d_to['x'])."' and `y`='".($d_to['y'])."'"));
$DialogMSG = 'Механизм успешно задействован.<br />Решетка '.(($GetDoor['doors'] == 0)?'поднята':'опущена').'.';
mysql_query("UPDATE `labyrinth` SET `doors`='".(($GetDoor['doors'] == 0)?1:0)."' WHERE `x`='".($d_to['x'])."' and `y`='".($d_to['y'])."'");
$UsedTime = 30;
$UsedMove = false;
}
if($GetMove['L_img'] == '8'){
$DialogMSG = 'Ваша плоть расщепилась на молекулы.<br />Вы успешно телепортировались.';
$UsedTime = 30;
$UsedMove = true;
}
if($GetMove['L_img'] == '9'){
$DialogMSG = 'Тут очень тесно, темно и мокро.<br />Но вы успешно попали на ту сторону лаза.';
$UsedTime = 30;
$UsedMove = true;
}
mysql_query("UPDATE `user` SET ".(($UsedMove) ? "`pos`='".$GetMove['d_to']."'," : '')."`wait`='".(time()+$UsedTime)."' WHERE `id`='".$pers['id']."'");
$pers['pos'] = (($UsedMove) ? $GetMove['d_to'] : $pers['pos'] );
$pers['wait'] = time()+$UsedTime;
}else{
if($GetMove['L_img'] == '3'){
$DialogMSG = 'Похоже что механизм поломан.<br />Вам защемило руку.';
}
if($GetMove['L_img'] == '8'){
$DialogMSG = 'Похоже что телепорт не работает.<br />Ваша нога застряла.';
}
if($GetMove['L_img'] == '9'){
$DialogMSG = 'Вы застряли и пытаетесь выбраться.<br />Наверное, кому-то надо меньше есть...';
}
mysql_query("UPDATE `user` SET `wait`='".(time()+50)."' WHERE `id`='".$pers['id']."'");
$pers['wait'] = time()+50;
}
}
}
break;
// Соберите 4 куска старинной карты и принесите мне.
case'80':
switch($_GET['di']){
case'0':
$rotation = array('0'=>array('0'=>array('x'=>0,'y'=>-1)),'90'=>array('0'=>array('x'=>1,'y'=>0)),'180'=>array('0'=>array('x'=>0,'y'=>1)),'270'=>array('0'=>array('x'=>-1,'y'=>0)));
$GoTo = mysql_fetch_assoc(mysql_query("SELECT * FROM `labyrinth` WHERE `x`='".($pers['x']+$rotation[$pers['rotation']]['0']['x'])."' AND `y`='".($pers['y']+$rotation[$pers['rotation']]['0']['y'])."'"));
if(!empty($GoTo) and $pers['wait']<time()){
mysql_query("UPDATE `user` SET `pos`='".($pers['x']+$rotation[$pers['rotation']]['0']['x'])."_".($pers['y']+$rotation[$pers['rotation']]['0']['y'])."'".(($GoTo['L_img'] != 11)?",`wait`='".(time()+10)."'":"")." WHERE `id`='".$pers['id']."'");
$pers['pos'] = ($pers['x']+$rotation[$pers['rotation']]['0']['x'])."_".($pers['y']+$rotation[$pers['rotation']]['0']['y']);
$pers['wait'] = (($GoTo['L_img'] != 11) ? time()+10 : 0);
}
break;
case'1':
$rotation = array('0'=>array('1'=>array('x'=>0,'y'=>1)),'90'=>array('1'=>array('x'=>-1,'y'=>0)),'180'=>array('1'=>array('x'=>0,'y'=>-1)),'270'=>array('1'=>array('x'=>1,'y'=>0)));
$GoTo = mysql_fetch_assoc(mysql_query("SELECT * FROM `labyrinth` WHERE `x`='".($pers['x']+$rotation[$pers['rotation']]['1']['x'])."' AND `y`='".($pers['y']+$rotation[$pers['rotation']]['1']['y'])."'"));
if(!empty($GoTo) and $pers['wait']<time()){
mysql_query("UPDATE `user` SET `pos`='".($pers['x']+$rotation[$pers['rotation']]['1']['x'])."_".($pers['y']+$rotation[$pers['rotation']]['1']['y'])."'".(($GoTo['L_img'] != 11)?",`wait`='".(time()+10)."'":"")." WHERE `id`='".$pers['id']."'");
$pers['pos'] = ($pers['x']+$rotation[$pers['rotation']]['1']['x'])."_".($pers['y']+$rotation[$pers['rotation']]['1']['y']);
$pers['wait'] = (($GoTo['L_img'] != 11) ? time()+10 : 0);
}
break;
case'2':
$rotation = array('0'=>array('2'=>array('x'=>-1,'y'=>0)),'90'=>array('2'=>array('x'=>0,'y'=>-1)),'180'=>array('2'=>array('x'=>1,'y'=>0)),'270'=>array('2'=>array('x'=>0,'y'=>1)));
$GoTo = mysql_fetch_assoc(mysql_query("SELECT * FROM `labyrinth` WHERE `x`='".($pers['x']+$rotation[$pers['rotation']]['2']['x'])."' AND `y`='".($pers['y']+$rotation[$pers['rotation']]['2']['y'])."'"));
if(!empty($GoTo) and $pers['wait']<time()){
mysql_query("UPDATE `user` SET `pos`='".($pers['x']+$rotation[$pers['rotation']]['2']['x'])."_".($pers['y']+$rotation[$pers['rotation']]['2']['y'])."'".(($GoTo['L_img'] != 11)?",`wait`='".(time()+10)."'":"")." WHERE `id`='".$pers['id']."'");
$pers['pos'] = ($pers['x']+$rotation[$pers['rotation']]['2']['x'])."_".($pers['y']+$rotation[$pers['rotation']]['2']['y']);
$pers['wait'] = (($GoTo['L_img'] != 11) ? time()+10 : 0);
}
break;
case'3':
$rotation = array('0'=>array('3'=>array('x'=>1,'y'=>0)),'90'=>array('3'=>array('x'=>0,'y'=>1)),'180'=>array('3'=>array('x'=>-1,'y'=>0)),'270'=>array('3'=>array('x'=>0,'y'=>-1)));
$GoTo = mysql_fetch_assoc(mysql_query("SELECT * FROM `labyrinth` WHERE `x`='".($pers['x']+$rotation[$pers['rotation']]['3']['x'])."' AND `y`='".($pers['y']+$rotation[$pers['rotation']]['3']['y'])."'"));
if(!empty($GoTo) and $pers['wait']<time()){
mysql_query("UPDATE `user` SET `pos`='".($pers['x']+$rotation[$pers['rotation']]['3']['x'])."_".($pers['y']+$rotation[$pers['rotation']]['3']['y'])."'".(($GoTo['L_img'] != 11)?",`wait`='".(time()+10)."'":"")." WHERE `id`='".$pers['id']."'");
$pers['pos'] = ($pers['x']+$rotation[$pers['rotation']]['3']['x'])."_".($pers['y']+$rotation[$pers['rotation']]['3']['y']);
$pers['wait'] = (($GoTo['L_img'] != 11) ? time()+10 : 0);
}
break;
}
break;
case'90':
switch($_GET['di']){
case'0':
$pers['rotation'] -= 90;
if($pers['rotation'] < 0){
$pers['rotation'] = 270;
}
mysql_query("UPDATE `user` SET `rotation`='".$pers['rotation']."' WHERE `id`='".$pers['id']."'");
break;
case'1':
$pers['rotation'] += 90;
if($pers['rotation'] > 270){
$pers['rotation'] = 0;
}
mysql_query("UPDATE `user` SET `rotation`='".$pers['rotation']."' WHERE `id`='".$pers['id']."'");
break;
}
break;
}
}
}
if($_GET['get_id'] == '24' and in_array($_GET['vcode'],$_SESSION['vcodes'])){
switch($_GET['act']){
case'2':
switch($_GET['type']){
case'1':
$GetAuc = mysql_fetch_assoc(mysql_query("SELECT * FROM `auction` WHERE `id`='".intval($_GET['luid'])."' and `uid`='".$pers['id']."' and `ItemID`='".intval($_GET['wuid'])."' and `FirstBetID`='0'"));
if($GetAuc){
$GetItem = mysql_fetch_assoc(mysql_query("SELECT * FROM `invent` WHERE `id_item`='".$GetAuc['ItemID']."' and `auction`='1'"));
if($GetItem){
mysql_query("UPDATE `invent` SET `auction`='0' WHERE `id_item`='".$GetItem['id_item']."'");
mysql_query("DELETE FROM `auction` WHERE `id`='".$GetAuc['id']."'");
echo"<script>alert('Вы успешно сняли "".$GetItem['ItemName']."" с торгов.');</script>";
}
}
break;
case'2':
$GetAuc = mysql_fetch_assoc(mysql_query("SELECT * FROM `auction` WHERE `id`='".intval($_GET['luid'])."' and `uid`='".$pers['id']."' and `ItemID`='".intval($_GET['wuid'])."' and `FirstBetID`='0'"));
if($GetAuc){
$GetItem = mysql_fetch_assoc(mysql_query("SELECT * FROM `invent` WHERE `id_item`='".$GetAuc['ItemID']."' and `auction`='1'"));
if($GetItem){
mysql_query("UPDATE `invent` SET `auction`='0' WHERE `id_item`='".$GetItem['id_item']."'");
mysql_query("DELETE FROM `auction` WHERE `id`='".$GetAuc['id']."'");
echo"<script>alert('Вы успешно сняли "".$GetItem['ItemName']."" с торгов.');</script>";
}
}
break;
}
break;
}
}
if($_GET['get_id'] == '9' and in_array($_GET['vcode'],$_SESSION['vcodes'])){
switch($_GET['go']){
case'1':
if($pers['nv']>=Level_rooms($pers['level'])){
$time_chp = (($pers['chp']-time())/2);
$time_cmp = (($pers['cmp']-time())/2);
mysql_query("UPDATE `user` SET `loc`='50',`chp`='".($time_chp+time())."',`cmp`='".($time_cmp+time())."',`nv`='".($pers['nv']-Level_rooms($pers['level']))."' WHERE `id`='".$pers['id']."'");
$pers['loc'] = 50;
}
break;
case'2':
$time_chp = (($pers['chp']-time())*2);
$time_cmp = (($pers['cmp']-time())*2);
mysql_query("UPDATE `user` SET `loc`='4',`chp`='".($time_chp+time())."',`cmp`='".($time_cmp+time())."' WHERE `id`='".$pers['id']."'");
$pers['loc'] = 4;
break;
case'3':
if($pers['nv']>=Level_rooms($pers['level'])){
/* Считаем травмы */
$TravmTime = '';
$aff=explode("|",$pers['affect']);
foreach ($aff as $val){
$v=0;
$par=explode("@",$val);
if($par[1]>time()){
$par[1]-=time();
}
if($par[2]>0 and $par[2]<5){
$par[1] = ($par[1]/2);
}
$TravmTime .= $par[0].'@'.($par[1]+time()).'@'.$par[2].'|';
}
/* конец травмы */
mysql_query("UPDATE `user` SET `loc` = '51',`affect`='".$TravmTime."',`nv`='".($pers['nv']-Level_rooms($pers['level']))."' WHERE `id`='".$pers['id']."'");
$pers['loc'] = 51;
}
break;
case'4':
/* Считаем травмы */
$TravmTime = '';
$aff=explode("|",$pers['affect']);
foreach ($aff as $val){
$v=0;
$par=explode("@",$val);
if($par[1]>time()){
$par[1]-=time();
}
if($par[2]>0 and $par[2]<5){
$par[1] = ($par[1]*2);
}
$TravmTime .= $par[0].'@'.($par[1]+time()).'@'.$par[2].'|';
}
/* конец травмы */
mysql_query("UPDATE `user` SET `loc` = '4',`affect`='".$TravmTime."' WHERE `id`='".$pers['id']."'");
$pers['loc'] = 4;
break;
}
}
if($_GET['get_id'] == '18'){
$GetItem = mysql_fetch_array(mysql_query("SELECT `invent`.*, `items`.* FROM `items` INNER JOIN `invent` ON `items`.`id` = `invent`.`protype` WHERE `invent`.`pl_id` = '".$pers['id']."' and `invent`.`used` = '0' and `invent`.`cl_id` = '' and `invent`.`id_item` = '".intval($_GET['uid'])."';"));
$access = explode("|",$pers['clan_accesses']);
if(!empty($GetItem) and in_array('1',$access)){
mysql_query("UPDATE `invent` SET `cl_id` = '".$pers['clan_id']."',`gift` = 'Подарок от "".$pers['login'].""' WHERE `used` = '0' AND `id_item` = '".$GetItem['id_item']."' AND `pl_id` = '".$pers['id']."'");
echo"<center><b><font class=nickname><font color=#cc0000>Вы успешно пожертвовали вещь "".$GetItem['name']."" в казну.</font></font></b></center>";
}
unset($GetItem);
}
if($_GET['get_id'] == '26' and in_array($_GET['vcode'],$_SESSION['vcodes']) and $pers['nv']>=5000){
mysql_query("UPDATE `clans` SET `vote`='".(time()+259200)."' WHERE `clan_id`='".$pers['clan_id']."'");
mysql_query("UPDATE `user` SET `nv`=`nv`-'5000' WHERE `id`='".$pers['id']."' LIMIT 1;");
}
if($_GET['get_id'] == '29' and in_array($_GET['vcode'],$_SESSION['vcodes'])){
$_GET['plid'] = intval($_GET['plid']);
$cuser = mysql_fetch_array(mysql_query("SELECT `id`,`clan_id` FROM `user` WHERE `id`='".$_GET['plid']."'"));
$clan = mysql_fetch_array(mysql_query("SELECT * FROM `clans` WHERE `clan_id` = '".$pers['clan_id']."'"));
if($_GET['clan_act'] == '1'){
$GetItem = mysql_num_rows(mysql_query("SELECT * FROM `invent` WHERE `used` = '1' AND `cl_id` = '".$clan['clan_id']."' AND `pl_id` = '".$_GET['plid']."'"));
$WhoItem = GetUserFID($_GET['plid'],1);
$access = explode("|",$pers['clan_accesses']);
if($GetItem>0 and in_array('2',$access) and $WhoItem['last']<=(time()-300)){
mysql_query("UPDATE `invent` SET `used` = '0' WHERE `used` = '1' AND `cl_id` = '".$clan['clan_id']."' AND `pl_id` = '".$WhoItem['id']."'");
echo"<center><b><font class=nickname><font color=#cc0000>Вы успешно раздели персонажа "".$WhoItem['login']."".</font></font></b></center>";
CalcStats($WhoItem['id']);
}elseif($GetItem<1){
echo"<center><b><font class=nickname><font color=#cc0000>На персонаже "".$WhoItem['login']."" не найдено не одной клан вещи.</font></font></b></center>";
}
unset($GetItem);
}elseif($_GET['clan_act'] == '2'){
if($cuser['clan_id'] == $clan['clan_id']){
mysql_query("UPDATE `user` SET `clan`='',`clan_id`='none',`pair_id`='none',`clan_gif`='',`sklon`='0',`clan_d`='' WHERE `id`='".$cuser['id']."'");
mysql_query("UPDATE `user` SET `nv`=nv-100 WHERE `id` = '".$pers['id']."'");
}
}elseif($_GET['clan_act'] == '3' and $pers['clan_status'] == '9'){
mysql_query("DELETE FROM `clan_documents` WHERE `id` = '".intval($_GET['doc_id'])."' AND `clan_id` = '".$pers['clan_id']."'");
}elseif($_GET['clan_act'] == '4'){
$GetItem = mysql_fetch_assoc(mysql_query("SELECT * FROM `invent` WHERE `used` = '0' AND (`cl_id` = '".$clan['clan_id']."' or `cl_id` = '".$clan['pair_id']."') AND `id_item` = '".intval($_GET['uid'])."' AND `pl_id` = '".$_GET['plid']."'"));
$access = explode("|",$pers['clan_accesses']);
if(!empty($GetItem) and in_array('1',$access)){
mysql_query("UPDATE `invent` SET `pl_id` = '".$pers['id']."' WHERE `used` = '0' AND (`cl_id` = '".$clan['clan_id']."' or `cl_id` = '".$clan['pair_id']."') AND `id_item` = '".$GetItem['id_item']."'");
echo"<center><b><font class=nickname><font color=#cc0000>Вы удачно взяли "".ItemName($GetItem['protype'])."" из казны.</font></font></b></center>";
}
unset($GetItem);
}elseif($_GET['clan_act'] == '5'){
$GetItem = mysql_fetch_assoc(mysql_query("SELECT * FROM `invent` WHERE `used` = '1' AND (`cl_id` = '".$clan['clan_id']."' or `cl_id` = '".$clan['pair_id']."') AND `id_item` = '".intval($_GET['uid'])."' AND `pl_id` = '".$_GET['plid']."'"));
$WhoItem = GetUserFID($_GET['plid'],1);
$access = explode("|",$pers['clan_accesses']);
if(!empty($GetItem) and in_array('2',$access) and $WhoItem['last']<=(time()-300)){
mysql_query("UPDATE `invent` SET `used` = '0' WHERE `used` = '1' AND (`cl_id` = '".$clan['clan_id']."' or `cl_id` = '".$clan['pair_id']."') AND `id_item` = '".$GetItem['id_item']."'");
echo"<center><b><font class=nickname><font color=#cc0000>Вы удачно сняли "".ItemName($GetItem['protype'])."" с персонажа "".$WhoItem['login']."".</font></font></b></center>";
CalcStats($WhoItem['id']);
}
unset($GetItem);
}
}
if($_GET['get_id'] == '56' and in_array($_GET['vcode'],$_SESSION['vcodes']) ){
switch($_GET['act']){
case'10':
switch($_GET['go']){
case'dep':
if($pers['wite']<time()){
list($pers['x'], $pers['y']) = explode('_', $pers['pos']);
$LocID = mysql_result(mysql_query("SELECT `dep` FROM `nature` WHERE `x`='".$pers['x']."' AND `y`='".$pers['y']."'"),0);
if($LocID){
mysql_query("UPDATE `user` SET `loc`='".$LocID."' WHERE `id`='".$pers['id']."'");
exit(header("Location: /main.php"));
}
}
break;
case'up':
$LocID = mysql_result(mysql_query("SELECT `go_id` FROM `locations` WHERE `id`='".$pers['loc']."'"),0);
if($LocID){
mysql_query("UPDATE `user` SET `loc`='".$LocID."' WHERE `id`='".$pers['id']."'");
exit(header("Location: /main.php"));
}
break;
}
break;
case '11':
if($_GET['go']){
mysql_query("UPDATE `user` SET `loc`='".$_GET['go']."' WHERE `id`='".$pers['id']."'");
header("Location: /main.php");
}
break;
}
}
if($_GET['get_id'] == '16' and in_array($_GET['vcode'],$_SESSION['vcodes']) and $pers['nv']>=intval($_GET['pr'])){
switch($_GET['act']){
case'1':
$x=($_GET['x']);
$y=($_GET['y']);
mysql_query("UPDATE `user` SET `nv`=`nv`-'".intval($_GET['pr'])."',`pos`='".$x."_".$y."' WHERE `id`='".$pers['id']."'");
exit(header("Location: /main.php"));
break;
}
}
if($_GET['get_id'] == '99' and in_array($_GET['vcode'],$_SESSION['vcodes'])){
include( DROOT . "/includes/database/buildings.php");
$castle = mysql_fetch_array(mysql_query("SELECT * FROM `castles` WHERE `sign` = '".$pers['clan_id']."'"));
switch($_GET['act']){
case '1':
if(!empty($_GET['upbuild']) and $castle['castle_build'] == '0|0'){
if(!preg_match("/[^a-z]/",$_GET['upbuild'])){
$time = intval($Buildings[$_GET['upbuild']]['set_time'][0]*((($castle[$_GET['upbuild']])?$Buildings[$_GET['upbuild']]['set_time'][1]*$castle[$_GET['upbuild']]:'1')));
mysql_query("UPDATE `castles` SET `castle_build`='".$_GET['upbuild']."|".(time()+$time)."' WHERE `sign`='".$castle['sign']."'");
$castle['castle_build'] = $_GET['upbuild'].'|'.(time()+$time);
echo time()." <> ".$time." <> ".(time()+$time);
}
}
break;
case '2':
mysql_query("UPDATE `castles` SET `castle_build`='0|0' WHERE `sign`='".$castle['sign']."'");
break;
}
}
?>