Hello, I'm new to .lua editing and was wondering if I could modify the behavior of InteruptBar by only showing the frame in PVP (Arenas, Battlegrounds, and possibly when flagged for PVP), similar to how Spy has the options to only show the frame in Arenas & BGs.
Is it possible for me to hard-code it into the .lua file?
local f = ? -- FrameReference not sure of the name
f:RegisterEvent("PLAYER_ENTERING_WORLD") -- register the event to run after each loading screen
f:HookScript("OnEvent", function(f, event) -- we only add this to the current function, instead of replacing it entirely (then we match the event to be what we expect, before we run our code)
if event == "PLAYER_ENTERING_WORLD" then
local instanceType = select(2, IsInInstance())
if instanceType == "pvp" or instanceType == "arena" then
f:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED")
else
f:UnregisterEvent("COMBAT_LOG_EVENT_UNFILTERED")
end
end
end)
InterruptBar does not give its frame a global name, so you cannot (easily) access it from outside of the addon's own Lua file. The following simple modification to InterruptBar.lua should work.
["ZONE_CHANGED_NEW_AREA"] = function(self)
local _, instanceType = IsInInstance()
if instanceType == "arena" or instanceType == "pvp" or (instanceType == "none" and GetZonePVPInfo() == "combat") then
self:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED")
self:Show()
else
self:UnregisterEvent("COMBAT_LOG_EVENT_UNFILTERED")
InterruptBar_ResetAllTimers()
self:Hide()
end
end,