erorus / db2
魔兽世界数据文件的DB2阅读器
Requires
- ext-curl: *
- ext-gmp: *
- ext-mbstring: *
This package is not auto-updated.
Last update: 2024-09-19 11:03:41 UTC
README
DB2 Reader
这是一个用于读取魔兽世界中的DB2和ADB/DBCache文件(数据表)的小型库。
要求
该库使用64位PHP 7开发,并针对PHP 5.6进行了测试。建议使用64位版本以支持无符号32位整型和64位整型。
所有格式都需要mbstring扩展,而WDC1支持则需要gmp扩展。
用法
// Instantiate an object with the path to a DB2 file. $db2Reader = new Reader("Achievement.db2"); // Records are presented as simple arrays. // Some fields are, themselves, arrays of values. // Get individual records by ID with: $record = $db2Reader->getRecord(17); // Loop through records with: foreach ($db2Reader->generateRecords() as $id => $record) { ... } // All valid record IDs: $ids = $db2Reader->getIds(); // You can set field names for convenience: $db2Reader->setFieldNames([0 => "name", 1 => "note", ...]); $record = $db2Reader->getRecord(17); if ($record['name'] == "...") ... // All integers are assumed to be unsigned, but you can change that by field: $db2Reader->setFieldsSigned([2 => true, 7 => true]); $record = $db2Reader->getRecord(17); if ($record[2] < 0) ... // You can get the calculated field types, // useful when dynamically creating database tables: $types = $db2Reader->getFieldTypes(); if ($types['name'] == Reader::FIELD_TYPE_STRING) ... // You can load an ADB or DBCache, as long as you have its parent DB2. // That reader will only expose records in the Hotfix/DBCache file. $adbReader = $db2Reader->loadAdb("Achievement.adb"); $dbCacheReader = $db2Reader->loadDBCache("DBCache.bin"); // Finally, you can specify both the DB2 and the DBCache file when constructing a HotfixedReader. // This has the same interface as Reader, but will substitute hotfixed records when available. $hotReader = new HotfixedReader("Achievement.db2", "DBCache.bin");
还可以查看example.php,这是我在开发期间使用的。
兼容性
应支持DB2文件的所有功能(偏移量映射/内嵌字符串、复制块、公共块、调色板数据等)。
预期加密块在由该库读取之前由您的CASC工具解密。对于无法解密的块(例如,因为密钥未知),您的CASC工具应将NUL字节替换为加密块的长度。DB2Reader会忽略加密且数据为空的块。
ADBs/DBCache需要其对应的DB2文件以获取必要的元数据,并通过WoWDBDefs访问字段大小需要互联网访问。
目标
这用于The Undermine Journal (Newsstand),以数据挖掘物品、宠物和其他实体。
免责声明
此工作既未获得Blizzard Entertainment的认可,也未与其有合作关系。
感谢
大部分文件格式细节是在WoWDev wiki的文档中找到的。感谢那些为此做出贡献的人!
感谢WoWDBDefs为我们提供了游戏可执行文件使用的表格式,这样我们就可以解析热补丁。
许可协议
版权所有 2017 Gerard Dombroski
根据Apache License, Version 2.0(“许可协议”)许可;除非遵守许可协议,否则不得使用这些文件。您可以在以下位置获取许可证副本:
https://apache.ac.cn/licenses/LICENSE-2.0
除非适用法律要求或书面同意,否则在许可证下分发的软件按“原样”分发,不提供任何明示或暗示的保证或条件。有关许可证中规定的具体语言管辖权限和限制,请参阅许可证。