WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   General Authoring Discussion (https://www.wowinterface.com/forums/forumdisplay.php?f=20)
-   -   GetItemInfo() (https://www.wowinterface.com/forums/showthread.php?t=16826)

Everglow 06-20-08 12:46 AM

GetItemInfo()
 
Hello all you brilliant coders. I am trying to write a mod that stores loot distribution info in a SavedVariable DB when the user is Master Looter. all works fine except for one problem. GetItemInfo() does not seem to work if I have never "owned" the item in question. Just looking at it in the loot window doesn't seem to do the trick. Is there a way to force an item into the local cache, or some other way to get the following information: .. ?
1. (necessary info) rarity of the item
2. (helpful, but not critical info) item ID

Tekkub 06-20-08 02:12 AM

Quote:

Originally Posted by Everglow (Post 94015)
Is there a way to force an item into the local cache

Set a tooltip. yourtooltip:SetHyperlink("item:"..itemid)

Mejloc 06-20-08 02:45 AM

and you can extract the item id from the item link posted in your chat frame.

Everglow 06-20-08 08:06 PM

Thanks Tekkub... I like your outside-the-box mind. btw, your mods are great.

Mejloc, that's what I'm parsing, and couldn't extract the info from the chat string. But thanks for the reply.

Everglow 06-21-08 01:33 AM

solved
 
I actually resolved my problem by using GetLootSlotItem() to retrieve the itemLink :)

Mejloc 06-21-08 10:27 AM

pattern = string.gsub(string.gsub(value, "(%%s)", "(.+)"), "(%%d)", "(.+)");
local start, fin, arg1, arg2, arg3 = string.find(msg, pattern)

where value is i.e. LOOT_ITEM_SELF and msg is your loot event string.

Depending which loot event type you got, arg? is different and contains the owner, item and amount. In case of LOOT_ITEM_SELF arg1 contains the itemlink, rest is nil.

now you extract the needed info from the link.

this is how i realized a simple item tracker.

Everglow 06-22-08 01:02 AM

You can see the clean and simple way in the addon itself... MasterLewtLogger. It may not be quite as flexible, but it's fast and efficient.


All times are GMT -6. The time now is 10:07 PM.

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