You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When a user purchases an item from a vendor, and that item is still refundable, and the user tries to use that item, the game will pop up a confirmation dialog. Clicking Okay on the dialog ultimately calls C_Item.ConfirmNoRefundOnUse(). Addons can automate the confirmation by calling the same function. However, the function will sometimes work without errors and sometimes issue a protected error.
There is no way for an addon to know in advance whether the C_Item.ConfirmNoRefundOnUse() call will be protected or permitted. The event triggered and dialog displayed are both identical. The event does not have a payload that could identify the protection state.
There is no way for an addon to test whether the use of this call with a specific item will cause an error, nor is there a reasonable way to catch and suppress the protection error. This means that if an addon tries to automate handling this dialog, the user could unpredictably get a protection error, leading to a bad user experience.
It is also worth considering if there is an actual benefit in protecting this function.
Reproduction steps:
Both scenarios assume a character that has not learned the mentioned item. Both scenarios assume no addons are installed, although in a real usage example, the final /run step of each scenario would normally be replaced by an addon responding to the event in step 4.
Scenario 1: No error
Purchase the item Preserved Deep-Dweller's Staff from Aeden Braesmeld in Hallowfall.
Note that the item has text indicating it is still refundable.
Right click the item in your bag to use it.
The game fires the event USE_NO_REFUND_CONFIRM
The event causes a static popup of type USE_NO_REFUND_CONFIRM to appear.
In the chat box, execute this command to simulate clicking Okay to learn the item. This invokes the dialog's :OnAccept() function, which ultimately calls C_Item.ConfirmNoRefundOnUse(). /run StaticPopupDialogs["USE_NO_REFUND_CONFIRM"]:OnAccept()
Result: Doing this via /run or in an addon works correctly and without error.
Scenario 2: Error
Purchase the item Alchemy Lab, Level 2 from Sparz Boltwist or Rezlak in your Draenor garrison.
Note that the item has text indicating it is still refundable.
Right click the item in your bag to use it.
The game fires the event USE_NO_REFUND_CONFIRM
The event causes a static popup of type USE_NO_REFUND_CONFIRM to appear.
In the chat box, execute this command to simulate clicking Okay to learn the item. This invokes the dialog's :OnAccept() function, which ultimately calls C_Item.ConfirmNoRefundOnUse(). /run StaticPopupDialogs["USE_NO_REFUND_CONFIRM"]:OnAccept()
Result: Doing this via /run or in an addon generates an error (e.g., from /run: "[ADDON_ACTION_FORBIDDEN] AddOn '*** ForceTaint_Strong ***' tried to call the protected function 'ConfirmNoRefundOnUse()'."
Full sample error:
1x [ADDON_ACTION_FORBIDDEN] AddOn '*** ForceTaint_Strong ***' tried to call the protected function 'ConfirmNoRefundOnUse()'.
[string "@!BugGrabber/BugGrabber.lua"]:485: in function <!BugGrabber/BugGrabber.lua:485>
[string "=[C]"]: in function `ConfirmNoRefundOnUse'
[string "@Blizzard_StaticPopup_Frame/Mainline/StaticPopup.lua"]:1903: in function `OnAccept'
[string "StaticPopupDialogs["USE_NO_REFUND_CONFIRM"]:OnAccept()"]:1: in main chunk
[string "=[C]"]: in function `RunScript'
[string "@Blizzard_ChatFrameBase/Mainline/ChatFrame.lua"]:2304: in function `?'
[string "@Blizzard_ChatFrameBase/Mainline/ChatFrame.lua"]:5492: in function <Blizzard_ChatFrameBase/Mainline/ChatFrame.lua:5438>
[string "=[C]"]: in function `ChatEdit_ParseText'
[string "@Blizzard_ChatFrameBase/Mainline/ChatFrame.lua"]:5144: in function <Blizzard_ChatFrameBase/Mainline/ChatFrame.lua:5143>
[string "=[C]"]: ?
[string "=[C]"]: in function `ChatEdit_SendText'
[string "@Blizzard_ChatFrameBase/Mainline/ChatFrame.lua"]:5180: in function `ChatEdit_OnEnterPressed'
[string "*ChatFrame.xml:140_OnEnterPressed"]:1: in function <[string "*ChatFrame.xml:140_OnEnterPressed"]:1>
Locals:
_ = Frame {
}
event = "ADDON_ACTION_FORBIDDEN"
events = <table> {
}
Suggested resolutions:
The function C_Item.ConfirmNoRefundOnUse() is always permitted.
The function C_Item.ConfirmNoRefundOnUse() is always protected.
The event USE_NO_REFUND_CONFIRM is modified to add a payload that informs the listening addon whether the function will be permitted or protected.
The text was updated successfully, but these errors were encountered:
Summary:
When a user purchases an item from a vendor, and that item is still refundable, and the user tries to use that item, the game will pop up a confirmation dialog. Clicking Okay on the dialog ultimately calls
C_Item.ConfirmNoRefundOnUse()
. Addons can automate the confirmation by calling the same function. However, the function will sometimes work without errors and sometimes issue a protected error.There is no way for an addon to know in advance whether the
C_Item.ConfirmNoRefundOnUse()
call will be protected or permitted. The event triggered and dialog displayed are both identical. The event does not have a payload that could identify the protection state.There is no way for an addon to test whether the use of this call with a specific item will cause an error, nor is there a reasonable way to catch and suppress the protection error. This means that if an addon tries to automate handling this dialog, the user could unpredictably get a protection error, leading to a bad user experience.
It is also worth considering if there is an actual benefit in protecting this function.
Reproduction steps:
Both scenarios assume a character that has not learned the mentioned item. Both scenarios assume no addons are installed, although in a real usage example, the final
/run
step of each scenario would normally be replaced by an addon responding to the event in step 4.Scenario 1: No error
:OnAccept()
function, which ultimately callsC_Item.ConfirmNoRefundOnUse()
./run StaticPopupDialogs["USE_NO_REFUND_CONFIRM"]:OnAccept()
Result: Doing this via /run or in an addon works correctly and without error.
Scenario 2: Error
:OnAccept()
function, which ultimately callsC_Item.ConfirmNoRefundOnUse()
./run StaticPopupDialogs["USE_NO_REFUND_CONFIRM"]:OnAccept()
Result: Doing this via /run or in an addon generates an error (e.g., from /run: "[ADDON_ACTION_FORBIDDEN] AddOn '*** ForceTaint_Strong ***' tried to call the protected function 'ConfirmNoRefundOnUse()'."
Full sample error:
Suggested resolutions:
C_Item.ConfirmNoRefundOnUse()
is always permitted.C_Item.ConfirmNoRefundOnUse()
is always protected.The text was updated successfully, but these errors were encountered: