Mercurial > wow > cyborg-mmo7
annotate 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 |
rev | line source |
---|---|
jerome@65 | 1 local dump = require 'dump' |
jerome@65 | 2 local path = require 'path' |
jerome@65 | 3 local registry = require 'registry' |
jerome@65 | 4 local casc = require 'casc' |
jerome@65 | 5 local dbc = require 'casc.dbc' |
jerome@65 | 6 |
jerome@65 | 7 |
jerome@65 | 8 local root = |
jerome@65 | 9 registry.HKLM.SOFTWARE['Blizzard Entertainment']['World of Warcraft'] 'InstallPath' or |
jerome@65 | 10 registry.HKLM.SOFTWARE.Wow6432Node['Blizzard Entertainment']['World of Warcraft'] 'InstallPath' |
jerome@65 | 11 root = path.split(root) |
jerome@65 | 12 |
jerome@65 | 13 -- load local build config |
jerome@65 | 14 local buildKey,cdnBase,cdnKey = assert(casc.localbuild(tostring(root / '.build.info'), casc.selectActiveBuild)) |
jerome@65 | 15 |
jerome@65 | 16 -- open the CASC |
jerome@65 | 17 local handle = casc.open(tostring(root / 'Data'), buildKey, cdnBase, cdnKey) |
jerome@65 | 18 |
jerome@65 | 19 -- read the mount database |
jerome@65 | 20 local Mount = handle:readFile("DBFilesClient/Mount.db2") |
jerome@65 | 21 |
jerome@65 | 22 -- create a mapping from mount ID to spell ID |
jerome@65 | 23 local map = {} |
jerome@65 | 24 for _,mount,spell in dbc.rows(Mount, 'u7.u.') do |
jerome@65 | 25 map[mount] = spell |
jerome@65 | 26 end |
jerome@65 | 27 |
jerome@65 | 28 -- save |
jerome@65 | 29 local file = assert(io.open("../MountMap.lua", 'wb')) |
jerome@65 | 30 assert(file:write("-- this is a generated file, do not edit, see support/gen-mount-db.lua\n")) |
jerome@65 | 31 assert(file:write("CyborgMMO_MountMap = "..dump.tostring(map).."\n")) |
jerome@65 | 32 assert(file:write("CyborgMMO_LocalMountMap = {}\n")) |
jerome@65 | 33 assert(file:close()) |
jerome@65 | 34 |