echo "<img src='../../../public/img/buttons/done.gif'><br/>"; $MAP_INCREMENTX = 2; $MAP_INCREMENTY = 1; echo "Reiniciando datos de Jugadores"; soMuchWin($globalConn->restartPlayerData()); echo "Asignando sectores iniciales"; $playerIdsArr = $globalConn->getAllPlayerIds(); $success = true; foreach ($playerIdsArr as $playerIdArr) { $playerId = $playerIdArr[0]; if ($playerId) { //require_once ("../test/register_functions.php"); require "../../controllers/global/set_initial_sector.php"; while (!$inserted) { require "../../controllers/global/seed_map_generator.php"; require "../../controllers/global/set_initial_sector.php"; } $startView = explode(",", $startCoordinates); $startX = $startView[0]; $startY = $startView[1]; $startX = max($startX - 5, 0); $startY = max($startY - 2, 0); $startView = $startX . "," . $startY; if (!$playerConn->setLastMapView($playerId, $startView, 5)) { $success = false; } } } soMuchWin($success); echo "Reinicio Completado"; soMuchWin(true);
$originX = $_POST['originX']; $originY = $_POST['originY']; } if ($originX % 2 > 0) { $originX++; $originY++; } while (!($MAP_WIDTH + $originX <= $MAX_WIDTH && $MAP_HEIGHT + $originY <= $MAX_HEIGHT)) { if ($originX >= 2) { $originX -= 2; } if ($originY >= 1) { $originY -= 1; } } $playerConn->setLastMapView($sessionPlayer->getId(), $originX . "," . $originY, $MAP_HEIGHT); /* Iniciamos los datos de los sectores con los nicks de ocupante y propietario */ //Con lo siguiente tenemos el problema del cálculo de recursos al recargar //$rs = $connection->getSectors(0, $MAP_WIDTH-1, 0, $MAP_HEIGHT-1); $sectorsArr = $sectorConn->getAllSectors(); $allSectors = array(); $visibleSectors = array(); $owned_sectors = array(); unset($_SESSION['capitolSector']); foreach ($sectorsArr as $sectorArr) { if (isset($allPlayers[$sectorArr[4]])) { $occupantId = $allPlayers[$sectorArr[4]]->getNick(); } else { $occupantId = NULL; } if (isset($allPlayers[$sectorArr[5]])) {
$errorMsg .= "* La extensión o el tamaño de los archivos no es correcta.\r\n <ul>\r\n <li>Se permiten archivos .png, .gif o .jpg</li>\r\n <li>se permiten archivos de 100 Kb máximo.</li>\r\n </ul>"; } else { move_uploaded_file($_FILES['avatar_file']['tmp_name'], $img_avatars . $nick . "_avatar.png"); move_uploaded_file($_FILES['flag']['tmp_name'], $img_flags . $nick . "_flag.png"); $images_ok = true; } } //var_dump($_FILES); //Comprobamos si el nombre existe y enviamos mensaje de error si procede $existente = $playerConn->getNickExists($nick); $disponible = !($existente or $nick == ""); if (!$disponible) { $errorMsg .= "<span>* El nombre no está disponible</span><br />"; } if (strcmp($pass1, $pass2) != 0) { $errorMsg .= "<span>* Las contraseñas son diferentes</span>"; } if ($images_ok && $disponible and strcmp($pass1, $pass2) == 0 and $pass1 != '') { $playerConn->InsertNewPlayer($nick, $pass1, $email, $nick . "_flag.png", $nick . "_avatar.png", $civName); $playerArr = $playerConn->getPlayerByNick($nick); $playerId = $playerArr[0]; require "../../controllers/register/set_initial_sector.php"; while (!$inserted) { require "../../controllers/register/seed_map_generator.php"; require "../../controllers/register/set_initial_sector.php"; } $playerConn->setLastMapView($playerId, $startCoordinates, 5); header("Location: ../../views/register/registered.php?player=" . $nick); } } require "../../views/register/registerView.php";