Frost Beacon sides question to AddOn makers
There is an AddOn Merfin from Icecrown made that I want to fix. The issue is related to GetInstanceDifficulty(). It returns 2 for ICC 25 HC, because the IDs are shared, as you know. It should return 4 for 25-heroic.
The question is specific to Sindragosa and Frost Beacon. The AddOn should whisper people affected by Frost Beacon with their side order by following DBM's order.
If you look below "Pay attention here" comment, it basically adds all players with Frost Beacon aura applied to affected and executes FBdoDisplay(). FBdoDisplay() firstly checks for instance's difficulty, which obviously is wrong because the shared IDs in ICC and secondly if the number of items inside affected. There are 2 tombs in 10-mode, 5 in 25 normal and 6 in 25 heroic. That's what the checks do.
Any idea how I can replace that GetInstanceDifficulty() check with something working in warmane? All I need is send whispers to the right people with their order. Let's say Frost Beacon on: Player1, Player2, Player3, Player4, Player5. It should send your side is LEFT to Player1 and Player2, CENTER to Player3 and 4 and RIGHT to Player5 and 6.
Code:
FB:SetScript("OnEvent", function(self, event, ...)
if event == "PLAYER_ENTERING_WORLD" then
if IsInInstance() and GetInstanceInfo() == "Icecrown Citadel" then
FB:RegisterEvent("CHAT_MSG_MONSTER_YELL")
else
FB:UnregisterEvent("CHAT_MSG_MONSTER_YELL")
FB:UnregisterEvent("COMBAT_LOG_EVENT_UNFILTERED")
end
elseif event == "CHAT_MSG_MONSTER_YELL" then
local text, srcName = ...
if srcName == "Sindragosa" and string.find(text, "Your incursion ends here") then
FB:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED")
end
elseif event == "COMBAT_LOG_EVENT_UNFILTERED" then
local _, subEvent, _, _, _, _, destName, _, _, spellName = ...
if subEvent == "SPELL_CAST_START" and spellName == "Ice Tomb" then
affected = {}
-- Pay attention here --
elseif subEvent == "SPELL_AURA_APPLIED" and spellName == "Frost Beacon" then
affected = affected or {}
table.insert(affected, destName)
if FBdoDisplay() then
local result = FBgetString(affected)
displayMSG(self, result, 7)
FB:UnregisterEvent("COMBAT_LOG_EVENT_UNFILTERED")
end
end
end
end)
local function FBdoDisplay()
local difficultyIndex = GetInstanceDifficulty()
if difficultyIndex == 1 or difficultyIndex == 3 then
if table.getn(affected) == 2 then return true end
elseif difficultyIndex == 2 then
if table.getn(affected) == 5 then return true end
elseif difficultyIndex == 4 then
if table.getn(affected) == 6 then return true end
end
end
local function FBSendMessage(index)
local difficultyIndex = GetInstanceDifficulty() -- 1-10nm, 3-10hc, 2-25nm, 4-25hc
local name = affected[index]
if name == UnitName("player") then return end
if difficultyIndex == 1 or difficultyIndex == 3 then
if index == 1 then SCMside("LEFT", name) end
if index == 2 then SCMside("RIGHT", name) end
elseif difficultyIndex == 2 then
if index == 1 then SCMside("LEFT", name) end
if index == 2 then SCMside("LEFT", name) end
if index == 3 then SCMside("CENTER", name) end
if index == 4 then SCMside("RIGHT", name) end
if index == 5 then SCMside("RIGHT", name) end
elseif difficultyIndex == 4 then
if index == 1 then SCMside("LEFT", name) end
if index == 2 then SCMside("LEFT", name) end
if index == 3 then SCMside("CENTER", name) end
if index == 4 then SCMside("CENTER", name) end
if index == 5 then SCMside("RIGHT", name) end
if index == 6 then SCMside("RIGHT", name) end
end
end
local function FBisPlayer(index)
if UnitName("player") == affected[index] then
FBPlaySoundFile(index)
return "<!!"..affected[index].."!!>"
else
if IsRaidOfficer() then
FBSendMessage(index)
end
return affected[index]
end
end
local function FBgetString(affectedTable)
local s = ""
if table.getn(affectedTable) == 2 then
local leftA = setClassColor(FBisPlayer(1), UnitClass(raidIbyName(affectedTable[1])))
local leftB = setClassColor(FBisPlayer(2), UnitClass(raidIbyName(affectedTable[2])))
s = string.format("|cFF00FF00Left:|r %s\n|cFF00FF00Right:|r %s", leftA, leftB)
elseif table.getn(affectedTable) == 5 then
local leftA = setClassColor(FBisPlayer(1), UnitClass(raidIbyName(affectedTable[1])))
local leftB = setClassColor(FBisPlayer(2), UnitClass(raidIbyName(affectedTable[2])))
local leftC = setClassColor(FBisPlayer(3), UnitClass(raidIbyName(affectedTable[3])))
local leftD = setClassColor(FBisPlayer(4), UnitClass(raidIbyName(affectedTable[4])))
local leftE = setClassColor(FBisPlayer(5), UnitClass(raidIbyName(affectedTable[5])))
s = string.format("|cFF00FF00Left:|r %s, %s\n|cFF00FF00Center:|r %s\n|cFF00FF00Right:|r %s, %s", leftA, leftB, leftC, leftD, leftE)
elseif table.getn(affectedTable) == 6 then
local leftA = setClassColor(FBisPlayer(1), UnitClass(raidIbyName(affectedTable[1])))
local leftB = setClassColor(FBisPlayer(2), UnitClass(raidIbyName(affectedTable[2])))
local leftC = setClassColor(FBisPlayer(3), UnitClass(raidIbyName(affectedTable[3])))
local leftD = setClassColor(FBisPlayer(4), UnitClass(raidIbyName(affectedTable[4])))
local leftE = setClassColor(FBisPlayer(5), UnitClass(raidIbyName(affectedTable[5])))
local leftF = setClassColor(FBisPlayer(6), UnitClass(raidIbyName(affectedTable[6])))
s = string.format("|cFF00FF00Left:|r %s, %s\n|cFF00FF00Center:|r %s, %s\n|cFF00FF00Right:|r %s, %s", leftA, leftB, leftC, leftD, leftE, leftF)
end
return s
end