function draw_map($map, $mas, $tile)
{
    global $xm;
    global $ym;
    global $sid;
    // $tile dlja kartinok potom
    foreach ($mas as $key => $val) {
        // dostaem x i y
        $key2 = $key;
        $key = explode('x', $key);
        // map nachinaetsja s 0x0 a ne 1x1
        $stag = $etag = '';
        if (isset($mas[$key2][8])) {
            $stag = '<a class="blue" href="game.php?sid=' . $sid . '&action=go_to_loc&loc_go=' . $mas[$key2][0] . '&stor=' . $mas[$key2][8] . '"><b>';
            $etag = '</b></a>';
        }
        $map[$key[1] * 2 - 1 + $ym][$key[0] * 2 - 1 + $xm] = $stag . $mas[$key2][6] . $etag;
        //$map[($key[1]+$ym)][($key[0]+$xm)] = $stag.$mas[$key2][6].$etag;
        $c = strlen($mas[$key2][4]);
        for ($i = 0; $i < $c; $i++) {
            $map = add_map($map, $mas[$key2][4][$i], $key[0] * 2 - 1 + $xm, $key[1] * 2 - 1 + $ym);
        }
    }
    return $map;
}
Exemplo n.º 2
0
    if ($loc[6] == 1) {
        $map[$y][$x] = $a1 . '<span class="blue">o</span>' . $a2;
    }
    if (!$loc[6]) {
        $map[$y][$x] = $a1 . '<span style="color:#258025">x</span>' . $a2;
    }
    if ($p['location'] == $mapname . '|' . $key[0] . 'x' . $key[1]) {
        $map[$y][$x] = '<b><u>' . $map[$y][$x] . '</u></b>';
    }
    $c = strlen($loc[4]);
    for ($i = 0; $i < $c; $i++) {
        $map = add_map($map, $loc[4][$i], $x, $y);
    }
    if ($loc[7]) {
        $loc[7] = explode(':', $loc[7]);
        $map = add_map($map, $loc[7][1], $x, $y);
    }
    if ($y > $left) {
        $left = $y;
    }
    if ($x > $right) {
        $right = $x;
    }
}
function add_map($map, $i, $x, $y)
{
    if ($i == 1) {
        $x--;
        $y++;
        $s = '&#92;';
    } elseif ($i == 2) {
Exemplo n.º 3
0
function hugeitgooglemaps_main()
{
    require_once "admin/maps_func.php";
    require_once "admin/maps_view.php";
    global $wpdb;
    if (!isset($_GET['task'])) {
        show_map();
    } else {
        if (isset($_GET['id'])) {
            $id = $_GET['id'];
        }
        $task = $_GET['task'];
        switch ($task) {
            case 'add_cat':
                add_map();
                break;
            case 'edit_cat':
                edit_map();
                break;
            case 'remove_cat':
                remove_map($id);
                show_map();
                break;
        }
    }
}
Exemplo n.º 4
0
     }
     break;
 case "POST":
     $json_arr = json_decode($json_string, true);
     if (is_array($json_arr)) {
         $title = $json_arr['title'];
         $map_id = $json_arr['id'];
         if (does_map_exist_by_title($student_id, $title)) {
             deliver_response(200, "Map with title '{$title}' already exists");
             break;
         }
         if (does_map_exist_by_id($student_id, $map_id)) {
             deliver_response(200, "Map with id={$map_id} already exist");
             break;
         }
         add_map($student_id, $json_string);
         deliver_response(201, "Map creation successful", $json_arr);
     } else {
         deliver_response(400, "The request cannot be fulfilled due to bad syntax");
     }
     break;
 case "PUT":
     $json_arr = json_decode($json_string, true);
     if (!does_map_exist_by_id($student_id, $map_id)) {
         deliver_response(200, "Map with id={$map_id} does not exist");
         break;
     }
     if ($map_id != $json_arr['id']) {
         deliver_response(200, "You cannot update map's id");
         break;
     }
function update_map($student_id, $map_id, $json_string)
{
    $json_arr = json_decode($json_string, true);
    $maps = get_user_maps($student_id);
    $maps = xml_maps_to_json($maps);
    $maps = json_decode($maps, true);
    foreach ($maps as &$map) {
        if ($map['id'] == $map_id) {
            foreach ($json_arr as $key => $value) {
                if (!empty($json_arr[$key])) {
                    $map[$key] = $json_arr[$key];
                }
            }
            delete_map($student_id, $map_id);
            $map = json_encode($map);
            add_map($student_id, $map);
            break;
        }
    }
}
Exemplo n.º 6
0
    //dbg: echo "Update Faction: $faction, $faction_icon, $faction_name";
    header("Location: admin_config.php?eb_games&gameid={$game_id}");
    exit;
}
if (isset($_POST['del_faction']) && $_POST['del_faction'] != "") {
    $faction = $_POST['del_faction'];
    delete_faction($faction);
    header("Location: admin_config.php?eb_games&gameid={$game_id}");
    exit;
}
if (isset($_POST['addmap'])) {
    $map_name = $_POST['mapname'];
    $map_image = $_POST['mapimage'];
    $map_description = $_POST['mapdescription'];
    if ($map_image != "" && $map_name != "") {
        add_map($game_id, $map_image, $map_name, $map_description);
    }
    //dbg: echo "Map: $game_id, $map_image, $map_name, $map_description";
    //exit();
    header("Location: admin_config.php?eb_games&gameid={$game_id}");
    exit;
}
if (isset($_POST['edit_map']) && $_POST['edit_map'] != "") {
    $map = $_POST['edit_map'];
    $map_name = $_POST['mapname' . $map];
    $map_image = $_POST['mapimage' . $map];
    $map_description = $_POST['mapdescription' . $map];
    if ($map_image != "" && $map_name != "") {
        update_map($map, $map_image, $map_name, $map_description);
    }
    //dbg: echo "Update Map: $map, $map_image, $map_name, $map_description";