ElvUI mMediaTag & Tools

ElvUI mMediaTag & Tools

1M Downloads

MONK class issue

BradHeff opened this issue ยท 1 comments

commented

Added "MONK" to the Mists of Pandaria classes list in core.lua since MONK was introduced in that expansion but was missing from the list.

Added additional validation in the concatenation operations in Tags.lua to check if targetStringColors[unitClass] exists before attempting to concatenate it, preventing future nil concatenation errors.

The error was occurring because: A MONK unit was being processed

The targetStringColors table was built from mMT.Classes which didn't include "MONK" for Mists
When the code tried to access targetStringColors["MONK"], it returned nil
The concatenation role .. targetStringColors[unitClass] .. ClassString failed because one of the operands was nil

core.lua

function mMT:ClassesTable()
    if E.Retail then
        return {"DEATHKNIGHT", "DEMONHUNTER", "DRUID", "EVOKER", "HUNTER", "MAGE", "MONK", "PALADIN", "PRIEST", "ROGUE",
                "SHAMAN", "WARLOCK", "WARRIOR"}
    elseif E.Classic then
        return {"HUNTER", "WARLOCK", "PRIEST", "PALADIN", "MAGE", "ROGUE", "DRUID", "SHAMAN", "WARRIOR"}
    elseif E.Mists then
        return {"HUNTER", "WARLOCK", "PRIEST", "PALADIN", "MAGE", "ROGUE", "DRUID", "SHAMAN", "WARRIOR", "DEATHKNIGHT",
                "MONK"}
    end
end

Tags.lua

for i = 1, GetNumGroupMembers() - 1 do
			if UnitIsUnit("party" .. i .. "target", unit) then
				local _, unitClass = UnitClass("party" .. i)
				if unitClass and targetStringColors[unitClass] then ClassString = targetTextures[style] .. targetStringColors[unitClass] .. ClassString end
			end
		end

		if UnitIsUnit("playertarget", unit) then
			local _, unitClass = UnitClass("player")
			if unitClass and targetStringColors[unitClass] then ClassString = targetTextures[style] .. targetStringColors[unitClass] .. ClassString end
		end
commented

Hello BradHeff, thank you is fixed and will be in next update.