3 -- This script creates a graph of the known quests for the various locales from static.lua using gnuplot.
5 loadfile("../static_deDE.lua")()
6 loadfile("../static_enUS.lua")()
7 loadfile("../static_esES.lua")()
8 loadfile("../static_esMX.lua")()
9 loadfile("../static_frFR.lua")()
10 loadfile("../static_koKR.lua")()
11 loadfile("../static_ruRU.lua")()
12 loadfile("../static_zhCN.lua")()
13 loadfile("../static_zhTW.lua")()
15 loadfile("../static.lua")()
21 for locale, data in pairs(QuestHelper_StaticData or {}) do
24 for faction in pairs({1, 2}) do
25 levels = data.quest and data.quest[faction] or {}
27 plotdata[locale][faction] = {}
29 for level = 1,maxlevel do
30 local list = levels[level] or {}
33 for name, data in pairs(list) do
36 for hash in pairs(data.alt) do
42 plotdata[locale][faction][math.ceil(level/5)] = (plotdata[locale][faction][math.ceil(level/5)] or 0) + count
47 file = io.open("plot.dat", "w")
51 for level = 1,maxlevel/5 do
53 for locale, data in pairs(plotdata) do
54 if data[1][level] > 0 or data[2][level] > 0 then use_locale[locale] = true end
55 line = line .. data[1][level].." "..data[2][level].." "
57 file:write(line.."\n")
60 use_locale["zhCN"] = false
62 local title = {enUS="English", frFR="Français", esES="Español (España)", deDE="Deutsch", koKR="한국어", esMX="Español (Mexico)", ruRU="Russian", zhCN="Chinese", zhTW="Taiwan"}
66 local locale_count = 0
67 for locale in pairs(plotdata) do
68 if use_locale[locale] then
69 locale_count = locale_count + 1
73 local locale_colour_alliance = {enUS="#ff0000", frFR="#0000aa", deDE="#666666", esES="#ffaa00", koKR="#00aaff", zhCN="#ff00ff", esMX="#dddddd", ruRU="#00ff00", zhTW="#ff80ff"}
74 local locale_colour_horde = {enUS="#dd0000", frFR="#000088", deDE="#44444444", esES="#dd8800", koKR="#0088dd", zhCN="#dd00dd", esMX="#bfbfbf", ruRU="#00dd00", zhTW="#6060dd"}
78 for locale in pairs(plotdata) do
79 if use_locale[locale] then
80 local a = (j-0.5)/(locale_count+1)+0.5
81 local b = a + 1/(locale_count+1)
83 command = (command and command..", " or "") .. "\"plot.dat\" using ($0+1):"..i..":($0+"..a.."):($0+"..b..") title \""..title[locale].."\" lc rgb '"..locale_colour_alliance[locale].."' with boxes"
84 command = (command and command..", " or "") .. "\"plot.dat\" using ($0+1):(-$"..(i+1).."):($0+"..a.."):($0+"..b..") notitle lc rgb '"..locale_colour_horde[locale].."' with boxes"
90 local stream = io.popen("gnuplot", "w")
93 --stream:write("set terminal svg size 800,600\n")
94 --stream:write("set output 'locale.svg'\n")
95 stream:write("set terminal png notransparent size 1024,768\n")
96 stream:write("set output 'locale.png'\n")
97 --stream:write("set terminal pdf colour\n")
98 --stream:write("set output 'locale.pdf'\n")
99 stream:write("set key title 'Quests'\n")
100 stream:write("set key top left Left reverse samplen 1\n")
101 stream:write("set style fill solid 1 border -1\n")
102 stream:write("set xlabel 'Level'\n")
103 local line = "set xtics ("
104 for i = 0,(maxlevel/5-1) do
105 line = line .. "'" .. i*5+1 .. "-" .. i*5+5 .. "' "..i+1 .. ((i == maxlevel/5-1) and ")\n" or ",")
108 stream:write("set ytics out scale 0 ('Alliance' 300, 'Horde' -300)\n")
109 if command then stream:write("plot [0:"..tostring(maxlevel/5+1).."]"..command..";\n") end
114 --os.remove("plot.dat")