view support/gen-mount-db.lua @ 71:60e5f3262337 tip

Added tag v6.1.0-1 for changeset 553715eacab6
author Jerome Vuarand <jerome.vuarand@gmail.com>
date Thu, 26 Feb 2015 14:18:54 +0000
parents 8b8b0bade520
children
line wrap: on
line source
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())