WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   Wish List (https://www.wowinterface.com/forums/forumdisplay.php?f=15)
-   -   UseQuestLogSpecialItem vs. the world (https://www.wowinterface.com/forums/showthread.php?t=50733)

Phanx 12-14-14 04:33 AM

UseQuestLogSpecialItem vs. the world
 
Dear Blizzard,

Your new objective tracker is the most delicate of flowers in a winter storm. Even looking sideways at seemingly unrelated things, like the world map, poisons it, rendering its quest item buttons unusable. It's even worse than the infamous and still-overly-sensitive-after-all-these-years UIDropDownMenu system.

You could solve the quest button problem very easily by making the UseQuestLogSpecialItem only require a hardware event, rather than it being a completely protected function. I understand you don't want addons automatically using quest items without the player making decisions, but I really don't see any serious potential for abuse if it requires a click/keypress. It's a quest that probably takes 5 minutes and zero thought beyond looking for the dot on the map -- side note: WTB epic quest chains back from vanilla! -- not raid progression or tournament PvP.

Rilgamon 12-14-14 05:18 AM

*sign with 10 letters*

myrroddin 12-14-14 06:11 AM

I've never used that API, but coincidentally I was thinking about it yesterday. Is it possible to securely hook UseQuestLogSpecialItem()? I'd imagine that would solve most of the problems.

Phanx 12-14-14 06:20 AM

Quote:

Originally Posted by myrroddin (Post 302469)
Is it possible to securely hook UseQuestLogSpecialItem()? I'd imagine that would solve most of the problems.

It's possible to securely hook anything:

Code:

hooksecurefunc("CastSpellByName", function(spell, target)
    print("You are casting", spell, "on the", target or "target", "unit.")
end)

But that doesn't solve any problems, since a secure hook just tells you that the function was called, and what arguments (if any) were passed to it; it doesn't magically let you call functions you're not allowed to call from addon code, and it doesn't let you affect the behavior of the original function.

Xrystal 12-14-14 09:01 AM

Signed here too ... I was quite surprised that literally reparenting the main frame broke the buttons security.

What makes it worse is that some of the items aren't physically in the bags to use manually that way, so I sure hope those ones work by clicking on the mobs in question.

JDoubleU00 12-14-14 12:41 PM

...Signed...

I do use the addon http://www.curse.com/addons/wow/questitembuttonfix, but Blizzard has broken all quest addons.

Haleth 12-14-14 01:38 PM

Yes please! This keeps breaking for me and I've absolutely no idea why.

Xrystal 12-14-14 01:39 PM

Hmm Interesting ..
Managed to get it not error out in my addon with the following minimal code:

Lua Code:
  1. ObjectiveTrackerFrame:SetAllPoints(frame)
  2. ObjectiveTrackerFrame:SetWidth(frame:GetWidth())
  3. ObjectiveTrackerBlocksFrame:SetWidth(frame:GetWidth())
  4. ObjectiveTrackerBlocksFrame:SetHeight(XObjectivesDB.ScrollHeight)
  5. ObjectiveTrackerBlocksFrame:SetPoint("LEFT",30,0)  
  6. frame:SetScrollChild(ObjectiveTrackerBlocksFrame)

frame being a ScrollFrame parented to UIParent or with nUI Infopanel as necessary.

However, this offsets the tracker lines too far to the left and and makes the POI Icons and check marks not appear properly or at all.

The line that fixes that is :
DEFAULT_OBJECTIVE_TRACKER_MODULE.blockOffsetX = 30
But the moment you use that or any of the specific modules versions it kicks out the error.

Also, the use of these two lines after that code (although not sure if I need it now I'm not re-parenting as such) also produces the error.
ObjectiveTracker_Update()
QuestObjectiveTracker_UpdatePOIs()

The moment I remove those 3 lines from the equation it allows you to click the button.

Edit:
I wonder if creating your own module stops the error. Might have to be something to look into at some point.

Xrystal 12-14-14 02:30 PM

After reading Resike's post elsewhere regarding this problem and I have rigged up the following mini addon.

Lua Code:
  1. local addonName,addonData = ...
  2.  
  3. local myScrollFrame
  4.  
  5. addonData.Options = {
  6.     FrameWidth = 500,
  7.     FrameHeight = 150,
  8.     IsMovable = true,
  9.     HasBorder = true,
  10. }
  11.  
  12. addonData.SetMovable = function(self,frame)
  13.     if not frame then return end
  14.     frame:EnableMouse(true)
  15.     frame:SetMovable(true)
  16.     frame:RegisterForDrag("LeftButton")
  17.     frame:SetScript("OnDragStart",function(self)
  18.         self:StartMoving()
  19.     end)
  20.  
  21.     frame:SetScript("OnDragStop",function(self)
  22.         self:StopMovingOrSizing()
  23.         self:SetUserPlaced(true)
  24.         self:SetClampedToScreen(true)
  25.     end)
  26.  
  27.     frame:SetScript("OnHide",function(self)
  28.         self:StopMovingOrSizing()
  29.         self:SetUserPlaced(true)
  30.         self:SetClampedToScreen(true)
  31.     end)
  32. end
  33.  
  34. addonData.AddBorder = function(self,frame)
  35.     local border = CreateFrame("Frame",_G[frame:GetName().."Border"],frame)
  36.     border:SetFrameLevel(frame:GetFrameLevel()-1)
  37.     border:SetFrameStrata(frame:GetFrameStrata())
  38.     border:ClearAllPoints()
  39.     border:SetPoint("TOPLEFT",-10,10)
  40.     border:SetPoint("BOTTOMRIGHT",35,-10)
  41.  
  42.     local backDrop = {      
  43.         bgFile = "Interface/Tooltips/UI-Tooltip-Background",
  44.         edgeFile = "Interface/Tooltips/UI-Tooltip-Border",
  45.         tile = true,
  46.         tileSize = 16,
  47.         edgeSize = 16,
  48.         insets =
  49.         {
  50.             left = 4,
  51.             right = 4,
  52.             top = 4,
  53.             bottom = 4
  54.         },
  55.     }                      
  56.     border:SetBackdrop(backDrop)
  57.     border:SetBackdropBorderColor( 1, 1, 0, 1 )
  58.     border:SetBackdropColor( 0, 0, 0, 1 )
  59.  
  60.     frame.border = border
  61. end
  62.  
  63. addonData.BuildScrollFrame = function(self,name,parent,options)
  64.     parent = parent or UIParent
  65.     local frame = CreateFrame("ScrollFrame",name,parent,"UIPanelScrollFrameTemplate")
  66.     frame.ScrollBar = _G[frame:GetName() .. "ScrollBar"];
  67.     frame.ScrollBar:SetPoint("LEFT",frame,"RIGHT",5,0)
  68.     frame:SetWidth(options.FrameWidth - 55)
  69.     frame:SetHeight(options.FrameHeight - 20)
  70.     if options.HasBorder then
  71.         self:AddBorder(frame)
  72.     end
  73.     if options.IsMovable then
  74.         self:SetMovable(frame)
  75.         if not frame:SetUserPlaced() then
  76.             frame:SetPoint("CENTER",parent,"CENTER",10,-10)
  77.         end
  78.     else
  79.         frame:SetPoint("CENTER",parent,"CENTER",10,-10)
  80.     end
  81.     ScrollFrame_OnLoad(frame)
  82.     frame:UpdateScrollChildRect()
  83.  
  84.     frame:SetScript("OnScrollRangeChanged",function(self,xrange,yrange)
  85.         ScrollFrame_OnScrollRangeChanged(self, xrange, yrange)
  86.         self:UpdateScrollChildRect()
  87.     end)
  88.  
  89.     frame:SetScript("OnVerticalScroll",function(self,offset)
  90.         addonData:OnVerticalScroll(frame,offset)
  91.         self:UpdateScrollChildRect()
  92.     end)
  93.  
  94.     frame:SetScript("OnMouseWheel",function(self,delta)
  95.         ScrollFrameTemplate_OnMouseWheel(self, delta)
  96.         self:UpdateScrollChildRect()
  97.     end)
  98.  
  99.     return frame
  100. end
  101.  
  102. addonData.OnVerticalScroll = function(self,frame,offset)
  103.     if offset == 0 then return end
  104.     local scrollbar = _G[frame:GetName().."ScrollBar"];
  105.     scrollbar:SetValue(offset);
  106.     local min;
  107.     local max;
  108.     min, max = scrollbar:GetMinMaxValues();
  109.     if ( offset == 0 ) then
  110.         _G[scrollbar:GetName().."ScrollUpButton"]:Disable();
  111.     else
  112.         _G[scrollbar:GetName().."ScrollUpButton"]:Enable();
  113.     end
  114.     if ((scrollbar:GetValue() - max) == 0) then
  115.         _G[scrollbar:GetName().."ScrollDownButton"]:Disable();
  116.     else
  117.         _G[scrollbar:GetName().."ScrollDownButton"]:Enable();
  118.     end
  119. end
  120.  
  121. local function CreateScrollFrame()
  122.     myScrollFrame = addonData:BuildScrollFrame("XrystalScrollFrame_ObjectivesTracker",UIParent,addonData.Options)
  123. end
  124.  
  125. local OTFMoving
  126. hooksecurefunc(ObjectiveTrackerFrame, "SetPoint", function(self)
  127.     if not myScrollFrame then return end
  128.     if OTFMoving then return end
  129.     OTFMoving = true
  130.     self:SetMovable(true)
  131.     self:SetUserPlaced(true)
  132.     self:ClearAllPoints()
  133.     self:SetPoint("TOPLEFT", myScrollFrame, "TOPLEFT", 30, 0)
  134.     self:SetScale(1.1)
  135.     self:SetWidth(addonData.Options.FrameWidth - 30)
  136.     self:SetHeight(1000)
  137.     myScrollFrame:SetScrollChild(self)
  138.     self:SetMovable(false)
  139.     OTFMoving = nil
  140. end)
  141.  
  142. --DEFAULT_OBJECTIVE_TRACKER_MODULE.blockOffsetX = 30
  143. CreateScrollFrame()

Feel free to try it out .. the questitems don't taint as long as I don't use that blockoffset value, if I don't use the blockoffset value it misaligns as it uses that every update to set the alignment of each block.


All times are GMT -6. The time now is 12:21 PM.

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