Exemplo n.º 1
0
error_reporting(E_ERROR | E_WARNING | E_PARSE | E_NOTICE);
require 'common.php';
$msgsuccess = null;
if (array_key_exists('arte', $_GET)) {
    $gerar = $_POST['acao'] == 'Gerar Token';
    $altura = intval($_POST['altura']);
    $margin_left = intval($_POST['margin_left']);
    $margin_top = intval($_POST['margin_top']);
    $rotate = intval($_POST['rotate']);
    if ($altura <= 0) {
        $altura = 140;
    }
    $id_arte = intval($_GET['arte']);
    $arte = new Arte($id_arte);
    Mapa::setHexWidth(160);
    Mapa::setHexHeight(140);
    Mapa::setHexSide(80);
    Mapa::setMapWidth(5);
    Mapa::setMapHeight(5);
    Mapa::gerarMapa();
    Mapa::getArea(0, 0)->setTipo(AREA_FORA);
    Mapa::getArea(4, 0)->setTipo(AREA_FORA);
    Mapa::getArea(0, 4)->setTipo(AREA_FORA);
    Mapa::getArea(1, 4)->setTipo(AREA_FORA);
    Mapa::getArea(3, 4)->setTipo(AREA_FORA);
    Mapa::getArea(4, 4)->setTipo(AREA_FORA);
    if ($gerar) {
        $width = Mapa::getTileAreaWidth();
        $height = Mapa::getTileAreaHeight();
        $height -= floor(Mapa::getHexWidth() / 2);
Exemplo n.º 2
0
 public static function carregarDoPost()
 {
     $margin_top = intval($_POST['margin_top']);
     $margin_left = intval($_POST['margin_left']);
     $map_width = intval($_POST['map_width']);
     $map_height = intval($_POST['map_height']);
     $hex_width = intval($_POST['hex_width']);
     $hex_height = intval($_POST['hex_height']);
     $hex_side = intval($_POST['hex_side']);
     if (trim($_POST['nome']) == '') {
         throw new Exception("Preencha o nome do mapa.");
     }
     if ($map_width <= 0) {
         throw new Exception("A largura do mapa precisa ser maior que zero.");
     }
     if ($map_height <= 0) {
         throw new Exception("A altura do mapa precisa ser maior que zero.");
     }
     if ($hex_width <= 0) {
         throw new Exception("A largura do hex precisa ser maior que zero.");
     }
     if ($hex_height <= 0) {
         throw new Exception("A algura do hex precisa ser maior que zero.");
     }
     if ($hex_side <= 0) {
         throw new Exception("O tamanho do lado de hex precisa ser maior que zero e menor que a largura.");
     }
     Mapa::setNome($_POST['nome']);
     Mapa::setMarginTop($margin_top);
     Mapa::setMarginLeft($margin_left);
     Mapa::setMapWidth($map_width);
     Mapa::setMapHeight($map_height);
     Mapa::setHexWidth($hex_width);
     Mapa::setHexHeight($hex_height);
     Mapa::setHexSide($hex_side);
 }