WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   Legion Beta archived threads (https://www.wowinterface.com/forums/forumdisplay.php?f=177)
-   -   GarrisonMissionListButtonTemplate button -> replace OnClick = ADDON_ACTION_FORBIDDEN (https://www.wowinterface.com/forums/showthread.php?t=53546)

sezz 06-08-16 06:28 AM

GarrisonMissionListButtonTemplate button -> replace OnClick = ADDON_ACTION_FORBIDDEN
 
Code: (click on a mission and press escape twice to close mission + main frame to get the error)

Lua Code:
  1. local GarrisonMissionButton_OnClickHook = function(self, button)
  2.     GarrisonMissionButton_OnClick(self, button);
  3. end
  4.  
  5. local GarrisonMissionList_UpdateHook = function(self)
  6.     local availableMissionsTabShown = not OrderHallMissionFrame.MissionTab.MissionList.showInProgress;
  7.     local missions = availableMissionsTabShown and OrderHallMissionFrame.MissionTab.MissionList.availableMissions or OrderHallMissionFrame.MissionTab.MissionList.inProgressMissions;
  8.     local numMissions = #missions;
  9.  
  10.     if (numMissions > 0) then
  11.         local scrollFrame = OrderHallMissionFrame.MissionTab.MissionList.listScroll;
  12.         local buttons = scrollFrame.buttons;
  13.         local offset = HybridScrollFrame_GetOffset(scrollFrame);
  14.         local numButtons = #buttons;
  15.  
  16.         for i = 1, numButtons do
  17.             local button = buttons[i];
  18.             local index = offset + i;
  19.  
  20.             if (index <= numMissions) then
  21.                 local mission = missions[i + offset];
  22.                 if (not button.hooked) then
  23.                     button:RegisterForClicks("LeftButtonUp", "RightButtonUp");
  24.                     button:SetScript("OnClick", GarrisonMissionButton_OnClickHook);
  25.                     button.hooked = true;
  26.                 end
  27.             end
  28.         end
  29.     end
  30. end
  31.  
  32. local f = CreateFrame("Frame");
  33. f:RegisterEvent("ADDON_LOADED");
  34. f:SetScript("OnEvent", function(self, event, addon)
  35.     if (addon == "Blizzard_OrderHallUI") then
  36.         hooksecurefunc(OrderHallMissionFrame.MissionTab.MissionList, "Update", GarrisonMissionList_UpdateHook);
  37.         self:UnregisterEvent(event);
  38.     end
  39. 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.

elcius 06-08-16 08:05 AM

you can't just call GarrisonMissionButton_OnClick, if you want to hook the click handler, use button:HookScript('OnClick',function() .. end)

Miiru 06-08-16 08:10 AM

I have had a lot of these errors myself while hooking stuff at the orderhall ui. The (basicly) same function work at the garrison ui without any error.
Going to the orderhall and typing /run OrderHallMissionFrame:MissionCompleteInitialize() will get the same taint as you posted, whilst at the agrrison
/run GarrisonMissionFrame:MissionCompleteInitialize() wont get any taint error. I also noticed that OrderHallMissionFrame.MissionPage,"EscapePressed" will easily cause taint :/
To me it almost seems like it puts the palyer in a state comparable to an incombat state and thus causing.

sezz 06-08-16 10:41 AM

Quote:

Originally Posted by elcius (Post 315506)
you can't just call GarrisonMissionButton_OnClick, if you want to hook the click handler, use button:HookScript('OnClick',function() .. end)

I don't want to hook it because Blizzard doesn't check for LeftButton and I don't want to show mission details when clicking a mission with the right mouse button.

But I did another test by adding a frame on top of the button that catches the clicks (so the mission button's OnClick handler doesn't get executed) and I still get the error, even if my OnClick handler is as simple as this (and basically does nothing, it only sets isZoneSupport, just like Blizzard does in OrderHallMission.OnClickMission):

Lua Code:
  1. local missionButton = self:GetParent();
  2. local missionFrame = missionButton:GetParent():GetParent():GetParent():GetParent():GetParent();
  3. local missionInfo = missionButton.info;
  4. missionFrame.MissionTab.isZoneSupport = missionInfo.isZoneSupport;

This is easily reproducable without any addons by clicking a mission, executing
Lua Code:
  1. /run OrderHallMissionFrame.MissionTab.isZoneSupport = OrderHallMissionFrame.MissionTab.isZoneSupport;
and pressing escape twice.

:confused:

sezz 06-14-16 11:34 PM

seems fixed now :banana:


All times are GMT -6. The time now is 05:18 AM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI