I want to extract the WoW SetDisplayInfo database.
How can I do this without freezing my PC? Basically I want to track models from 1-100000.
Currently my idea is to use the model change event. But it is a drycode. I need to test it first. Not sure if the model update event fires on a unitless frame. I may be able to trick it by using self:SetUnit("player") though.
I don't think the event will fire properly for my frame. We will see.
Lua Code:
local model = CreateFrame("PlayerModel")
model.index = 1
model.maxIndex = 100000
model.defaultModel = "interface\\buttons\\talktomequestionmark.m2"
model:RegisterEvent("UNIT_PORTRAIT_UPDATE")
model:RegisterEvent("UNIT_MODEL_CHANGED")
model:RegisterEvent("PLAYER_LOGIN")
model:SetScript("OnEvent", function(self,event,...)
self[event](...)
end)
function model:UNIT_PORTRAIT_UPDATE(...)
print("UNIT_PORTRAIT_UPDATE")
print(self:GetModel())
end
function model:UNIT_MODEL_CHANGED(...)
print("UNIT_MODEL_CHANGED")
print(self:GetModel())
end
function model:PLAYER_LOGIN(...)
print("PLAYER_LOGIN")
self:SetNewModel()
end
function model:SetNewModel()
print("clear model")
self:ClearModel()
print("SetModel default")
self:SetModel(self.defaultModel) --will be uses if displayinfo fails
print("SetDisplayInfo "..self.index)
self:SetDisplayInfo(self.index)
end
function model:NewIndex()
self.index = self.index + 1
end
Is the model update event catch enough throtteling? Or do I need an OnUpdate handler that just parses chunks of models?
What I want to extract is the model name. It contains a lot of information about the used model that could be split into keywords. Thus you could rebuild the model database using keywords. Like "show me every human model".