Not sure i understand what you meant with the function GetSpellName but here's what i did, if that's correct.
Code:
local _, caelUI = ...
caelUI.readycheck = caelUI.createModule("ReadyCheck")
local GetSpellName = function(id)
return GetSpellInfo(id)
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
GetSpellName(105689), -- Flask of Spring Blossoms
GetSpellName(127230), -- For testing purpose: Vision of Insanity
}
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))
local flask
for i = 1, #flasks do
flask = UnitBuff("player", flasks[i])
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
But now i get:
Code:
Error occured in: Global
Message:
..\AddOns\caelUI\modules\misc\readyCheck.lua line 52:
Usage: UnitBuff("unit", [index] or ["name", "rank"][, "filter"])
Debug:
[C]: ?
[C]: UnitBuff()
caelUI\modules\misc\readyCheck.lua:52:
caelUI\modules\misc\readyCheck.lua:35