Checking for a boolean true is unnecessary in most cases:
Code:
if MBFlaresDB.partyShow == true then
if MBFlaresDB.partyShow then
You should use the
[ CODE ] tag or
[ highlight=Lua ][ /highlight ] to retain the indenting:
Lua Code:
function MBFlares_partyChecker() -- hide/show in raid
if MBFlaresDB.partyShow then
if GetNumRaidMembers() == 0 then -- NOT IN RAID
if GetNumPartyMembers() == 0 then -- AND NOT IN A PARTY
MBFlares_mainFrame:Hide()
else -- IN A PARTY
MBFlares_mainFrame:Hide()
end
else -- IN A RAID
if IsRaidLeader() or IsRaidOfficer() then -- ABLE TO MARK
MBFlares_mainFrame:Show()
else -- BUT NOT ABLE TO MARK
MBFlares_mainFrame:Hide()
end
end
else
MBFlares_mainFrame:Show()
end
end
You could also just check against the
Instance Type, since the player needs to be inside the raid/instance to mark the raid target mobs
(only "downside" is that this method doesn't show it outside the party/raid instance)
Lua Code:
function MBFlares_partyChecker() -- hide/show in raid
if MBFlaresDB.partyShow then
local _, instanceType = IsInInstance()
if instanceType == "party" then -- IN A PARTY
MBFlares_mainFrame:Show()
elseif instanceType == "raid" and ( IsRaidLeader() or IsRaidOfficer() ) then -- IN A RAID AND ABLE TO MARK
MBFlares_mainFrame:Show()
else -- NOT ABLE TO MARK
MBFlares_mainFrame:Hide()
end
end
end