예제 #1
0
function renderMap($mapId, $outSizeX = 0, $pointsList = 0, $render = 'defaultMapRenderCallback')
{
    global $gMapCoord, $gmapName, $lang;
    $mapName = '<a href=?instance=' . $mapId . '>' . getMapName($mapId) . '</a>';
    if (empty($mapName)) {
        echo "{$lang['map_no_found']}&nbsp;{$mapId}<br>";
        return;
    }
    $map = getRenderMapData($mapId);
    if (empty($map)) {
        echo "{$lang['no_image']}&nbsp;{$mapName}&nbsp;({$mapId})<br>";
        return;
    }
    // Данные карты
    $areaX1 = $map[0];
    $areaX2 = $map[1];
    $areaY1 = $map[2];
    $areaY2 = $map[3];
    $imageY = $outSizeX == 0 ? $map[5] : $outSizeX;
    $imageX = $outSizeX == 0 ? $map[4] : intval($map[4] * $outSizeX / $map[5]);
    $image = "images/map_image/maps/" . $map[6];
    $sizeX = $imageX + 4;
    $sizeY = $imageY;
    $tableBorder = 1;
    $tableWidth = $sizeY + $tableBorder * 2 + 8;
    echo "<table class=map border={$tableBorder} width={$tableWidth}px>";
    echo "<tbody><tr><td id=mappername class=mapname>{$mapName}</td></tr>";
    echo "<tr><td width={$sizeY}px height={$sizeX}px align=left valign=top>";
    echo "<div id=mapperarea style=\"position: relative; border: 0px; left: 0px; top: 0px;\">";
    echo "<img src={$image} width={$imageY}px height={$imageX}px>\n";
    if ($pointsList) {
        foreach ($pointsList as $point) {
            $posMap = $point['map'];
            $posX = $point['position_x'];
            $posY = $point['position_y'];
            $posZ = $point['position_z'];
            transformWorldCoordinates($posMap, $posX, $posY, $posZ);
            if ($mapId == $posMap and $areaY1 >= $posY and $areaY2 <= $posY and $areaX1 >= $posX and $areaX2 <= $posX) {
                $x = $imageX * ($posX - $areaX1) / ($areaX2 - $areaX1);
                $y = $imageY * ($posY - $areaY1) / ($areaY2 - $areaY1);
                echo $render($point, $y, $x);
            }
        }
    }
    echo "</div>";
    echo "</td></tr></tbody>";
    echo "</table>";
}
예제 #2
0
             $tt .= "<tr><td class=name>" . validateText($c['name']) . " (" . $point['guid'] . ")</td></tr>";
             $tt .= "</table>";
             $mapdata['points'][$i]['tooltip'] = $tt;
             $i++;
         }
     }
 }
 // Portals to area
 $teleport_list = $dDB->selectPage($totalRecords, 'SELECT * FROM `areatrigger_teleport` WHERE `target_map` = ?d', $mapId);
 if ($teleport_list) {
     foreach ($teleport_list as $point) {
         $posMap = $point['target_map'];
         $posX = $point['target_position_x'];
         $posY = $point['target_position_y'];
         $posZ = $point['target_position_z'];
         transformWorldCoordinates($posMap, $posX, $posY, $posZ);
         if ($mapId == $posMap and $areaY1 >= $posY and $areaY2 <= $posY and $areaX1 >= $posX and $areaX2 <= $posX) {
             $x = ($posX - $areaX1) / ($areaX2 - $areaX1) * 100;
             $y = ($posY - $areaY1) / ($areaY2 - $areaY1) * 100;
             $mapdata['points'][$i]['id'] = $point['id'];
             $mapdata['points'][$i]['x'] = $y;
             $mapdata['points'][$i]['y'] = $x;
             $mapdata['points'][$i]['image'] = "images/map_points/binder_icon.gif";
             $mapdata['points'][$i]['icenterx'] = 8;
             $mapdata['points'][$i]['icentery'] = 8;
             $mapdata['points'][$i]['href'] = '';
             $mapdata['points'][$i]['tooltip'] = validateText($point['name']);
             $i++;
         }
     }
 }