pkn*_*dle 12
SC重放文件实际上是一个MPQ存档文件.此MPQ存档包含一些不同的文件(如.zip文件).
此存档内部是MPQ存档中每种数据类型的单独文件.(例如,有一个用于游戏事件的文件和另一个用于UI事件的文件).
有大量关于如何处理MPQ文件的在线文档.现在,MPQ中的各个文件有点棘手.
如果您想从重播中获取信息(玩家是谁以及他们玩的是什么地图),您可以使用这些工具.(我假设像Web服务器这样的Unix).
1)下载并构建libmpq和mpq-tools(https://libmpq.org/)
2)运行以下脚本
您可以从system()调用运行它们,然后运行一些拆分命令来获取玩家和比赛.
将其保存为info.sh. 像命令shell一样运行它并将重放文件作为参数传递.
#!/bin/bash
# Save this file as info.sh
# This extracts the individual files from the MPQ archive (the replay
# file)
mpq-extract -e $1 > /dev/null
cat file000000.xxx | strings | ruby info.rb
Run Code Online (Sandbox Code Playgroud)
这是一个ruby脚本.将其保存为info.rb
# This *kinda* extracts the file info from a header file. I don't
# really know how it works yet, so I'm just extracting strings.
#
# Save this file as info.rb
lines = STDIN.readlines
puts "%s:%s|%s:%s" % [(lines[0].strip), (lines[1].strip), (lines[2].strip), (lines[3].strip)]
Run Code Online (Sandbox Code Playgroud)
希望这可以帮助!