i'm trying make a addon for my guild because they almost always forget to change loot method in raid.
Code:
local frame = CreateFrame("Frame")
frame:RegisterEvent("GROUP_ROSTER_UPDATE")
local function eventHandler(self, event, ...)
if IsInRaid() and UnitInRaid("player") and UnitIsGroupLeader("player") then
if event == "GROUP_ROSTER_UPDATE" then
if InGuildParty()
then
SetLootMethod("master", UnitName("player"))
print("master")
else
SetLootMethod("freeforall")
print("free")
end
end
end
end
frame:SetScript("OnEvent", eventHandler)
it can auto select loot method now, but it'll try to select every second never end
i think something wrong in code but dont know how to fix it, wrong event? which should i use?