Mercurial > wow > cyborg-mmo7
diff support/gen-mount-db.lua @ 65:8b8b0bade520
Fixed support for mounts using the new MountJournal and mount IDs (no conversion of old profiles at the moment).
author | Jerome Vuarand <jerome.vuarand@gmail.com> |
---|---|
date | Thu, 23 Oct 2014 13:44:59 +0100 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/support/gen-mount-db.lua Thu Oct 23 13:44:59 2014 +0100 @@ -0,0 +1,34 @@ +local dump = require 'dump' +local path = require 'path' +local registry = require 'registry' +local casc = require 'casc' +local dbc = require 'casc.dbc' + + +local root = + registry.HKLM.SOFTWARE['Blizzard Entertainment']['World of Warcraft'] 'InstallPath' or + registry.HKLM.SOFTWARE.Wow6432Node['Blizzard Entertainment']['World of Warcraft'] 'InstallPath' +root = path.split(root) + +-- load local build config +local buildKey,cdnBase,cdnKey = assert(casc.localbuild(tostring(root / '.build.info'), casc.selectActiveBuild)) + +-- open the CASC +local handle = casc.open(tostring(root / 'Data'), buildKey, cdnBase, cdnKey) + +-- read the mount database +local Mount = handle:readFile("DBFilesClient/Mount.db2") + +-- create a mapping from mount ID to spell ID +local map = {} +for _,mount,spell in dbc.rows(Mount, 'u7.u.') do + map[mount] = spell +end + +-- save +local file = assert(io.open("../MountMap.lua", 'wb')) +assert(file:write("-- this is a generated file, do not edit, see support/gen-mount-db.lua\n")) +assert(file:write("CyborgMMO_MountMap = "..dump.tostring(map).."\n")) +assert(file:write("CyborgMMO_LocalMountMap = {}\n")) +assert(file:close()) +