Code: (click on a mission and press escape twice to close mission + main frame to get the error)
Lua Code:
local GarrisonMissionButton_OnClickHook = function(self, button)
GarrisonMissionButton_OnClick(self, button);
end
local GarrisonMissionList_UpdateHook = function(self)
local availableMissionsTabShown = not OrderHallMissionFrame.MissionTab.MissionList.showInProgress;
local missions = availableMissionsTabShown and OrderHallMissionFrame.MissionTab.MissionList.availableMissions or OrderHallMissionFrame.MissionTab.MissionList.inProgressMissions;
local numMissions = #missions;
if (numMissions > 0) then
local scrollFrame = OrderHallMissionFrame.MissionTab.MissionList.listScroll;
local buttons = scrollFrame.buttons;
local offset = HybridScrollFrame_GetOffset(scrollFrame);
local numButtons = #buttons;
for i = 1, numButtons do
local button = buttons[i];
local index = offset + i;
if (index <= numMissions) then
local mission = missions[i + offset];
if (not button.hooked) then
button:RegisterForClicks("LeftButtonUp", "RightButtonUp");
button:SetScript("OnClick", GarrisonMissionButton_OnClickHook);
button.hooked = true;
end
end
end
end
end
local f = CreateFrame("Frame");
f:RegisterEvent("ADDON_LOADED");
f:SetScript("OnEvent", function(self, event, addon)
if (addon == "Blizzard_OrderHallUI") then
hooksecurefunc(OrderHallMissionFrame.MissionTab.MissionList, "Update", GarrisonMissionList_UpdateHook);
self:UnregisterEvent(event);
end
end);
Error:
Code:
Message: ADDON_ACTION_FORBIDDEN: OrderHallTaint tried to call the protected function 'SpellStopCasting()'.
Time: 06/08/16 13:30:59
Count: 1
Stack: [C]: in function `SpellStopCasting'
Interface\FrameXML\UIParent.lua:3660: in function `ToggleGameMenu'
[string "TOGGLEGAMEMENU"]:1: in function <[string "TOGGLEGAMEMENU"]:1>
Locals: <none>
Any idea why this is happening or how to workaround this? It works fine at WoD garrisons in Legion (and of couse in WoD).
The reason why I'm replacing OnClick is to handle RightButtonUp (
GarrisonMissionButton_OnClick doesn't care about button).
I'm not getting the error when removing SpellStopCasting() and SpellStopTargeting() from
ToggleGameMenu() (or when moving securecall("CloseAllWindows") up 2 lines) and UnitCastingInfo("player") returns nil.
PS: @Dolby: This cloudflare protection is so annoying, it shows up *everytime* before previewing this post.