Skip to content

Instantly share code, notes, and snippets.

@Choonster
Created September 29, 2013 08:57
Show Gist options
  • Save Choonster/6750653 to your computer and use it in GitHub Desktop.
Save Choonster/6750653 to your computer and use it in GitHub Desktop.
A Lua script that takes the WoW FrameXML file GraphicsQualityLevels.lua and outputs a list of CVars with their values and the labels of the quality levels that use each value. Designed to be run from regular Lua (5.1, 5.2 or LuaJIT), but can be run within WoW if you replace dofile[[...]] with loadstring[[...]] (with the contents of GraphicsQuali…
VideoData = {}
VIDEO_OPTIONS_16XANISOTROPIC = "16x Anisotropic";
VIDEO_OPTIONS_2XANISOTROPIC = "2x Anisotropic";
VIDEO_OPTIONS_4XANISOTROPIC = "4x Anisotropic";
VIDEO_OPTIONS_8XANISOTROPIC = "8x Anisotropic";
VIDEO_OPTIONS_BILINEAR = "Bilinear";
VIDEO_OPTIONS_DISABLED = "Disabled";
VIDEO_OPTIONS_ENABLED = "Enabled";
VIDEO_OPTIONS_FAIR = "Fair";
VIDEO_OPTIONS_FULLSCREEN = "Fullscreen";
VIDEO_OPTIONS_HIGH = "High";
VIDEO_OPTIONS_LOW = "Low";
VIDEO_OPTIONS_MEDIUM = "Good";
VIDEO_OPTIONS_TRILINEAR = "Trilinear";
VIDEO_OPTIONS_ULTRA = "Ultra";
VIDEO_OPTIONS_WINDOWED = "Windowed";
VIDEO_OPTIONS_WINDOWED_FULLSCREEN = "Windowed (Fullscreen)";
-- Change this path to point to your copy of GraphicsQualityLevels.lua
dofile[[G:\Documents\WoW Art&Code\50400 (build 17399)\BlizzardInterfaceCode\Interface\FrameXML\GraphicsQualityLevels.lua]]
local values = setmetatable({}, {
__index = function(self, key)
self[key] = {}
return self[key]
end
})
local function processData(data)
if not data then return end
for _, levelData in ipairs(data) do
local cvars = levelData.cvars
if cvars then
for cvar, value in pairs(cvars) do
local levelText = values[cvar][value]
values[cvar][value] = levelText and (levelText .. ", " .. levelData.text) or levelData.text
end
end
end
end
for name, optionData in pairs(VideoData) do
processData(optionData.data)
processData(optionData.dataA)
processData(optionData.dataB)
local cvar = optionData.cvar
if cvar then
values[cvar].unknown = true
end
end
local tinsert, sort = table.insert, table.sort
local lines = {}
local temp = {}
for cvar, cvarValues in pairs(values) do
tinsert(lines, "----------------------")
tinsert(lines, "\"" .. cvar .. "\"")
tinsert(lines, "----------------------")
if cvarValues.unknown then
tinsert(lines, "Unkown values")
else
for value, levels in pairs(cvarValues) do -- Add the values to the temp array in unsorted order
tinsert(temp, value)
end
sort(temp) -- Sort the temp array
for i = 1, #temp do -- Add the line for each value to the lines array in sorted order
local value = temp[i]
tinsert(lines, value .. ": " .. cvarValues[value])
temp[i] = nil -- Remove the value from the temp array
end
end
tinsert(lines, "")
end
for _, line in ipairs(lines) do -- Print the lines
print(line)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment