Posted by /null on Wed, 08 Sep 2010 13:54:49
I have a GameTooltip for some item in the backpack. I need to get information about number of the slot and number of the container for that item via GameTooltip. I looked Widget API reference for more than five times, but could not find the solution. As an alternative, I would just rather the object ID and its amount in the current slot. However, how to get the amount of items in a single slot, not knowing the number of this slot I just do not understand. Please help...
Sorry for bad English... Translated by Google.
P.S. I created this topic in the Development section... I do not know how it got here.
Posted by jnwhiteh on Wed, 08 Sep 2010 14:45:31
A tooltip only indicates the item that it is displaying, not any information about where the item might exist in your containers or inventory. You can take the name or hyperlink, which you can get from GameTooltip:GetItem() and then search the player's containers to find out where the item might be, and how many items are in that slot. Hope that helps.
Posted by /null on Wed, 08 Sep 2010 15:22:28
I know. But it will not work. For example, if we have an item like [Rough Arrow] in same slots. In the first slot - 100 arrows, and the second slot - 200.
Is it possible to use GameTooltip:GetAttribute(...) or GameTooltip:GetOwner:GetAttribute(...) to get "type item"-attributes? (link) I tried, but got nil in any case. :(
Posted by jnwhiteh on Wed, 08 Sep 2010 15:26:06
They aren't set. The best you can do, which will not work for every situation, is to secure hook the GameTooltip:SetBagItem() method and keep track of which item the tooltip is set to display. There is NO way to query any information about what is being displayed by the tooltip other than the name.
Posted by /null on Wed, 08 Sep 2010 15:42:26
and keep track of which item the tooltip is set to display
Can you explain in details please?
Posted by jnwhiteh on Wed, 08 Sep 2010 17:17:56
Store the information in a variable. Hook the function, take the arguments, store them, and then you can query them later.
Posted by /null on Wed, 08 Sep 2010 18:14:05
Oh, sorry. I did not realize that it is a member of the GameTooltip and did not understand your idea. :) I'll try it.
Posted by /null on Thu, 09 Sep 2010 16:52:38
Thank you, jnwhiteh! SetBagItem() works fine.