Right so, this is a tiny addon i've had for a while to auto answer ready checks depnding on the situation.
Everything works exept the flask part, flask is always nil and i don't understand what i did wrong.
Code:
local _, caelUI = ...
caelUI.readycheck = caelUI.createModule("ReadyCheck")
local GetSpellName = function(spellId)
return GetSpellInfo(spellId)
end
local flasks = {
-- Cataclysm
GetSpellName(80719), -- Flask of Steelskin
GetSpellName(80720), -- Flask of the Draconic Mind
GetSpellName(80721), -- Flask of the Winds
GetSpellName(80723), -- Flask of Titanic Strength
GetSpellName(94162), -- Flask of Flowing Water
-- Pandaria
GetSpellName(105694), -- Flask of the Earth
GetSpellName(105691), -- Flask of the Warm Sun
GetSpellName(105696), -- Flask of Winter's Bite
GetSpellName(105693), -- Flask of Falling Leaves
GetSpellInfo(105689), -- Flask of Spring Blossoms
}
ReadyCheckListenerFrame:SetScript("OnShow", nil)
local isGuildGroup
caelUI.readycheck:SetScript("OnEvent", function(self, event)
if event == "PLAYER_ENTERING_WORLD" then
hooksecurefunc(GuildInstanceDifficulty, "Show", function()
isGuildGroup = true
end)
hooksecurefunc(GuildInstanceDifficulty, "Hide", function()
isGuildGroup = false
end)
elseif event == "READY_CHECK" then
PlaySoundFile([[Sound\Interface\ReadyCheck.wav]], "Master")
local food = UnitBuff("player", GetSpellName(104280))
for k, v in pairs(flasks) do
local flask = UnitBuff("player", k)
end
if (not isGuildGroup and food) or (isGuildGroup and flask and food) then
ReadyCheckFrame:Hide()
ConfirmReadyCheck(1)
end
end
end)
for _, event in next, {
"PLAYER_ENTERING_WORLD",
"READY_CHECK",
} do
caelUI.readycheck:RegisterEvent(event)
end