game/modules_data/moder/teleport-cometome.php
2022-06-07 00:30:34 +03:00

75 lines
4.2 KiB
PHP

<?
if (!defined('GAME')) {
die();
}
$action = $_POST['cometome'];
$toUser = mysql_real_escape_string($_POST['logingo']);
if (!isset($u->info['room']) OR !isset($u->info['id']) OR $toUser == '') {
if($toUser == '') {
$uer = 'Ïåðñîíàæ "' . $toUser . '" íå íàéäåí.';
} else $uer = 'Ðåæèì "' . $action . '" íå íàéäåí.';
} else {
if ($u->info['admin'] > 0) {
$uu = mysql_fetch_array(mysql_query('SELECT * FROM `users` WHERE `login` = "'.$toUser.'" LIMIT 1'));
$uus = mysql_fetch_array(mysql_query('SELECT * FROM `stats` WHERE `id` = "'.$uu['id'].'" LIMIT 1'));
if (isset($uu['id'])) {
if ($uu['id'] == $u->info['id']) {
$uer = 'Âû íå ìîæåòå òåëåïîðòèðîâàòü ñåáÿ ê ñåáå, ó âàñ íåò ðàçäâîåíèÿ ëè÷íîñòè! Åñëè íå ñîãëàñû - îáðàòèòåñü ê ïñèõèàòðó! ÑÐÎ×ÍÎ! ';
} elseif ($uu['admin'] > 0 && $u->info['admin'] == 0) {
$uer = 'Âû íå ìîæåòå òåëåïîðòèðîâàòü Àíãåëîâ ê ñåáå.';
} elseif (floor($uu['align']) == $a && $uu['align'] > $u->info['align'] && $u->info['admin'] == 0) {
$uer = 'Âû íå ìîæåòå òåëåïîðòèðîâàòü ñòàðøèõ ïî çâàíèþ';
} elseif ($u->info['battle'] == 0 && $action == 'to-fight') {
$uer = 'Âû íå ìîæåòå ïåðåìåñòèòü èãðîêà, ïîåäèíêà íå ñóùåñòâóåò.';
} elseif ($u->info['dnow'] == 0 && $action == 'to-dungeon') {
$uer = 'Âû íå ìîæåòå ïåðåìåñòèòü èãðîêà, âû íå â ïîäçåìåëüå.';
} elseif ($uu['city'] != $u->info['city'] && $u->info['admin'] == 0) {
$uer = 'Ïåðñîíàæ íàõîäèòñÿ â äðóãîì ãîðîäå';
} else {
/* Åñëè ïåðåìåùàåì â êîìíàòó - âûáðàñûâàåì ñ ïîåäèíêà è\èëè ïîäçåìåëüÿ. */
if($action =='to-room' && $uus['dnow']){
mysql_query('UPDATE `stats` SET `dnow` = "0" WHERE `id` = "' . $uu['id'] . '" LIMIT 1');
}
if($action =='to-room' && $uu['battle']){
mysql_query('UPDATE `users` SET `battle` = "0" WHERE `id` = "' . $uu['id'] .'" LIMIT 1');
}
/* Ïåðåíîñèì èãðîêà ïî äåéñòâèþ: Â êîìíàòó, Â êîìíàòó è ïîåäèíîê, Â êîìíàòó ïîäçåìåëüÿ*/
if ($action == 'to-room') {
$upd = mysql_query('UPDATE `users` SET `city` = "'.$u->info['city'].'", `room` = "'.$u->info['room'].'" WHERE `id` = "'.$uu['id'].'" LIMIT 1');
} elseif ($action == 'to-fight') {
$upd = mysql_query('UPDATE `users` SET `city` = "' . $u->info['city'] . '",`room` = "' . $u->info['room'] . '",`battle` = "' . $u->info['battle'] . '" WHERE `id` = "' . $uu['id'] .'" LIMIT 1');
$upd_d = mysql_query('UPDATE `stats` SET `team` = "' . $u->info['team'] . '" WHERE `id` = "' . $uu['id'] . '" LIMIT 1');
if ($u->info['dnow'] > 0) {
$upd_d = mysql_query('UPDATE `stats` SET `x` = "' . $u->info['x'] . '",`y` = "' . $u->info['y'] . '",`s` = "' . $u->info['s'] . '",`dnow` = "' . $u->info['dnow'] . '" WHERE `id` = "' . $uu['id'] . '" LIMIT 1');
}
} elseif ($action == 'to-dungeon') {
$upd = mysql_query('UPDATE `users` SET `city` = "' . $u->info['city'] . '",`room` = "' . $u->info['room'] . '" WHERE `id` = "' . $uu['id'] . '" LIMIT 1');
$upd_d = mysql_query('UPDATE `stats` SET `x` = "' . $u->info['x'] . '",`y` = "' . $u->info['y'] . '",`s` = "' . $u->info['s'] . '",`dnow` = "' . $u->info['dnow'] . '" WHERE `id` = "' . $uu['id'] . '" LIMIT 1');
} else {
$uer = 'Îøèáêà, äåéñòâèå íå âûáðàíî.';
$upd = false;
}
if ($upd) {
if ($upd_d) $dngo = true;
if ($u->info['sex'] == 1) $sx = 'à'; else $sx = '';
$rtxt = '[img[items/teleport-cometome.gif]] ' . $rang . ' &quot;' . $u->info['cast_login'] . '&quot; òåëåïîðòèðîâàë' . $sx . ' ïåðñîíàæà &quot;' . $uu['login'] . '&quot; ê ñåáå â ' . ($action == 'to-fight' ? "ïîåäèíîê" . ($dngo == true ? " è ïåùåðó." : "") : ($action == 'to-dungeon' ? "ïîäçåìåëüå" : "êîìíàòó")) . '.';
mysql_query("INSERT INTO `chat` (`new`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`,`typeTime`) VALUES (1,'" . $u->info['city'] . "','" . $u->info['room'] . "','','','" . $rtxt . "','" . time() . "','6','0','1')");
$uer = 'Âû óñïåøíî òåëåïîðòèðîâàëè ê ñåáå ïåðñîíàæà "' . $uu['login'] . '" â <b>' . ($action == 'to-fight' ? "ïîåäèíîê" : ($action == 'to-dungeon' ? "ïîäçåìåëüå" : "êîìíàòó")) . '</b>.';
} else {
$uer = 'Íå óäàëîñü èñïîëüçîâàòü äàííîå çàêëÿòèå';
}
}
} else {
$uer = 'Ïåðñîíàæ íå íàéäåí â ýòîì ãîðîäå';
}
} else {
$uer = 'Çàêëèíàíèå, òîëüêî äëÿ àäìèíèñòðàöèè';
}
}
?>