rogiel / star-map
PHP版的星际争霸II地图解析器
0.1.2
2016-07-24 22:53 UTC
Requires
- php: >=5.5
- rogiel/mpq: ^0.2.3
Requires (Dev)
- phpunit/phpunit: ^4.8
This package is not auto-updated.
Last update: 2024-09-14 18:58:30 UTC
README
此库允许您从PHP中读取星际争霸II地图文件。
提供了一个面向对象的API,用于浏览元数据和小地图图像。
功能
- 读取所有公共游戏版本中的.SC2Map文件
- 小地图:允许读取嵌入的小地图图像
安装
安装此库的推荐方法是使用Composer。
composer require "rogiel/star-map"
此库使用php-mpq来解析和提取地图文件中的压缩信息。
示例
use Rogiel\StarMap\Map; // Parse the map $map = new Map('Ruins of Seras.SC2Map'); // Get the map name in multiple locales $documentHeader = $map->getDocumentHeader(); echo sprintf('Map name (English): %s', $documentHeader->getName()).PHP_EOL; // english is default echo sprintf('Map name (French): %s', $documentHeader->getName('frFR')).PHP_EOL; // Get the map size $mapInfo = $map->getMapInfo(); $x = $mapInfo->getWidth(); $y = $mapInfo->getHeight(); echo sprintf('Map size: %sx%s', $x, $y).PHP_EOL; // Export Minimap image as a PNG $map->getMinimap()->toPNG('Minimap.png');
上述片段的输出如下
Map name (English): Ruins of Seras
Map name (French): Ruines de Seras
Map size: 224x192
祝您玩得开心!