This site makes extensive use of JavaScript.
Please enable JavaScript in your browser.
Live
PTR
10.2.7
PTR
10.2.6
Beta
[lua] Best way to precache items?
Post Reply
Return to board index
Post by
aggixx
Long story short, I'm writing a loot addon for my guild and I want to know what the best way to cache items every session to avoid errors from trying to retrieve attributes of an item that the user hasn't seen during the session.
As far as I can tell, opening the dungeon journals loot list magically caches all the items in the list, so I';m thinking I could silently open the journal to the list of all of the firelands loot every time the client loads in for the first time.
The problem is I don't really know how to manipulate blizzard's windows to do this. I know EncounterJournal:Show() does the same thing as shift+J, but beyond that I'm lost.
Anyone know how to do this, or know a better way of going about it?
Post by
Ketho
Here is a noobish way do it ><ToggleFrame(EncounterJournal)
ToggleFrame(EncounterJournal)
Sorry, for the bad suggestion ..
Post by
aggixx
Figured out how to do this. It turns out they changed the way item caching works with cataclysm.
If you have never seen the item that belongs to the Item ID or Item Link since the game client was started, this function immediately returns nil, but (starting in Cataclysm) will asynchronously query the server to provide the missing data. The item cache is not maintained between game sessions anymore.
So I all I did was have a precursor function like so:
function cacheItem(itemID, data1)
itemName = GetItemInfo(itemID)
if itemName == nil then
table.insert(waitingOnItemData, {itemID, data1})
else
runFunction(itemID, data1)
end
end
and then have a function that runs on the GET_ITEM_INFO_RECEIVED event, like so:
function events:GET_ITEM_INFO_RECEIVED(...)
if waitingOnItemData == nil then
--print("Item info queue is empty.")
else
runFunction(waitingOnItemData, waitingOnItemData)
table.remove(waitingOnItemData, 1)
end
end
Post Reply
You are not logged in. Please
log in
to post a reply or
register
if you don't already have an account.