View Single Post
11/24/21, 01:20 PM   #3
Baertram
Super Moderator
 
Baertram's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 4,971
Originally Posted by Shinni View Post
To fix this, you could hook IsItemUsable instead so that it will block the execution of UseItem here:
https://github.com/esoui/esoui/blob/...slot.lua#L1129
Depending on when you will prehook inventory related stuff and functions it may cause other error messages as the inventory code get's tainted, (via addon inserted code) before it was fully build.
It will show you lua errors like "'...from insecure code. The callstack became untrusted ...".

I was able to circumvent this for most cases by hooking into functions and handlers that get used in the inventory surrounding at EVENT_PLAYER_ACTIVATED instead of EVENT_ADD_ON_LOADED. But even then it could happen.

Btw: Another idea would be to hook into the inventory slot actions (LibCustomMenu should be able to help here) and prevent the addition of the "Use" action in total! This will remove the keybind for it as well + the context menu entry will be gone then.
I'm using this within FCOItemSaver e.g for protected items to remove the "Destroy", "Extract" and other actions for marked (protected) items.
Downside is: You'd also have to hook into the inventory row's eventHandler for "OnDoubleClick" to prevent the usage of the item via double click.

Last edited by Baertram : 11/24/21 at 01:26 PM.
  Reply With Quote