oldCode = $map->getOldCode(); $map->code = $map->getCode(); echo json_encode($map); exit; } if ($_REQUEST['mapByMap']) { $jsonMap = json_decode($_REQUEST['mapByMap']); $map = new map(); foreach ($jsonMap as $key => $value) { $map->$key = $value; } //Store the code in the object $map->oldCode = $map->getOldCode(); $map->code = $map->getCode(); echo json_encode($map); exit; } if ($_REQUEST['genMap']) { $map = GenerateMap( normalizeNumber($_REQUEST['width'], 50, 6), normalizeNumber($_REQUEST['height'], 50, 6), normalizeNumber($_REQUEST['rockChance'], 999, 5), normalizeNumber($_REQUEST['wallCount'], 9999, 0), normalizeNumber($_REQUEST['checkpoints'], 5, 0), normalizeNumber($_REQUEST['teleports'], 5, 0) ); //$map = getRandomSpecialMap(); $code = GenerateMapCode($map); $map = new map($code); $map->oldCode = $map->getOldCode(); $map->code = $map->getCode(); echo json_encode($map); exit; } function normalizeNumber($numberToFix, $upperBound, $lowerBound) { if (!is_int($numberToFix + 0)) return $lowerBound; if ($numberToFix < $lowerBound) return $lowerBound; if ($numberToFix > $upperBound) return $upperBound; return $numberToFix; } //Add's a new custom challenge map - returns mapid function addNewChallengeMap($map, $tier, $subOrder, $name) { $mapcode = GenerateMapCode($map); $sql = "INSERT INTO `challengeMaps` (`code`, `ChallengeTier`, `ChallengeSuborder`, `Name`) VALUES ('$mapcode', $tier, $subOrder, '$name')"; echo $sql; mysql_query($sql); $mapID = mysql_insert_id(); return $mapID; } //Returns challenge ID function addNewChallenge($mapID, $inequality, $goal, $ordering, $hint, $restrictWallCount = 'null', $restrictWallPlacement = 'null', $restrictTeleportCount = 'null', $restrictTeleportsUsed = 'null', $restrictStartPoint = 'null', $restrictEndPoint = 'null') { $sql = "INSERT INTO `challenges` ( `mapID`, `inequality`, `goal`, `ordering`, `hint`, `restrictWallCount`, `restrictWallPlacement`, `restrictTeleportCount`, `restrictTeleportsUsed`, `restrictStartPoint`, `restrictEndPoint` ) VALUES ( '$mapID', '$inequality', $goal, $ordering, '$hint', '$restrictWallCount', '$restrictWallPlacement', '$restrictTeleportCount', '$restrictTeleportsUsed', '$restrictStartPoint', '$restrictEndPoint' )"; echo $sql; mysql_query($sql); $challengeID = mysql_insert_id(); return $challengeID; } // Start Page: htmlHeader(array('stats', 'mapeditor'), 'Map Editor', 'Map Editor', array('dateformat')); ?>

Map Editor Beta

Load Map:
Load map by ID:
Load map by code:
Generate a random map:
Height:
Width:
Rockchance 1 in:
Checkpoints: (Max 5)
Teleports: (Max 5)
Settings:
Map Name:
Height:
Width:
Walls:
'; continue; } echo "
"; } ?>
Edit Map:
Loading...
Playable Map
OLD MapCode:
NEW MapCode:
Returned map goes here.