Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if(true) then
- return end
- -- Define what to find, remove the find table to find all
- local find = {
- SpellSchoolMask = true,
- CorpseType = true,
- GOState = true,
- LootState = true,
- WeatherType = true,
- SelectAggroTarget = true,
- TeamId = true,
- QuestFlags = true,
- RemoveMethod = true, -- this exists only on tc based sources
- UnitState = true,
- SpellSchools = true,
- Team = true,
- BattleGroundBracketId = true,
- BattleGroundTypeId = true,
- BattleGroundStatus = true,
- Locales = true,
- OpcodesList = true,
- BanMode = true,
- MailStationery = true,
- EnchantmentSlot = true,
- InventoryResult = true,
- TempSummonType = true, -- trinity to be followed
- Gender = true,
- Races = true,
- Classes = true,
- Powers = true,
- ItemQualities = true,
- CharacterSlot = true,
- Language = true,
- NPCFlags = true,
- UnitFlags = true,
- EObjectFields = true,
- EItemFields = true,
- EUnitFields = true,
- EGameObjectFields = true,
- }
- -- Paths to sources (key is name and value is path
- local PATH = {
- tcwotlk = "E:/Cores/Eluna/trin_wotlk/source/src",
- tccata = "E:/Cores/Eluna/trin_cata/source/src",
- mzero = "E:/Cores/Eluna/mang_zero/src",
- czero = "E:/Cores/Eluna/mang_classic/src",
- cone = "E:/Cores/Eluna/mang_tbc/src",
- ctwo = "E:/Cores/Eluna/mang_wotlk/src",
- }
- -- scroll to bottom for output folder
- -- utility
- local function WriteFile(path, str)
- local f = assert(io.open(path, "w"))
- f:write(str)
- f:close()
- end
- local function OpenFile(path)
- local f = assert(io.open(path, "r"))
- local str = f:read("*all")
- f:close()
- return str
- end
- local function scandir(path, files)
- local f = io.popen('dir "'..path..'" /b')
- if (not f) then return files end
- for name in f:lines() do
- if (name:find("%.")) then
- if (name:find("%.h$")) then
- table.insert(files, path.."/"..name)
- end
- else
- scandir(path.."/"..name, files)
- end
- end
- f:close()
- return files
- end
- for srcname, path in pairs(PATH) do
- local Files = scandir(path, {})
- local enums = {}
- local found = {}
- for k,v in ipairs(Files) do
- for code, name in OpenFile(v):gmatch("(enum%s+([%w_]+)[%s\n]+%b{})") do
- if (not find or find[name]) then
- table.insert(enums, code)
- found[name] = code
- end
- end
- end
- for k,v in pairs(find) do
- if(not found[k]) then
- print("Could not find "..k.." from "..srcname.." at "..path)
- end
- end
- table.sort(enums)
- -- Output file path
- WriteFile("output/"..srcname.."_enums.lua", table.concat(enums, "\n\n"))
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement