<?php
global $rooms;
$c = getCharMem($cEID);
$oldRoom = $c->getRoom();
$x = $oldRoom->getX();
$y = $oldRoom->getY();
if ($args == "n") {$nX = $x; $nY = $y+1;$dir = "north";}
if ($args == "nw") {$nX = $x-1; $nY = $y+1;$dir = "northwest";}
if ($args == "ne") {$nX = $x+1; $nY = $y+1;$dir = "northeast";}
if ($args == "w") {$nX = $x-1; $nY = $y;$dir = "west";}
if ($args == "e") {$nX = $x+1; $nY = $y;$dir = "east";}
if ($args == "s") {$nX = $x; $nY = $y-1;$dir = "south";}
if ($args == "sw") {$nX = $x-1; $nY = $y-1;$dir = "southwest";}
if ($args == "se") {$nX = $x+1; $nY = $y-1;$dir = "southeast";}
if (is_object($rooms[$nX][$nY])) // We have a good move //
{
$newRoom = $rooms[$nX][$nY];
// Update the player's room and save it (to cache) //
$c->setRoom($newRoom);
$c->loadToCache();
$oldRoom->removeCharacter($c);
$newRoom->addCharacter($c);
// Let everyone know what happened //
$c->send("You move to the $dir.", "caction");
look($cEID);
$oldRoom->send("{$c->getName()} leaves to the $dir.", "action");
$newRoom->send("{$c->getName()} enters the room.", "action", $c->getEID());
foreach ($oldRoom->getCharacters() as $key => $t) rc_Update($t);
foreach ($newRoom->getCharacters() as $key => $t) rc_Update($t);
map_Update($c, $oldRoom);
} else {
$c->send("There's no exit in that direction... Geez....", "caction");
}
?>