Thread Tools Display Modes
Prev Previous Post   Next Post Next
06-08-16, 06:28 AM   #1
sezz
A Chromatic Dragonspawn
AddOn Author - Click to view addons
Join Date: Apr 2008
Posts: 158
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.
 
 

WoWInterface » Site Forums » Archived Beta Forums » Legion Beta archived threads » GarrisonMissionListButtonTemplate button -> replace OnClick = ADDON_ACTION_FORBIDDEN


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off