Quantcast
Cache suggestions - WoWInterface
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
07-26-17, 11:04 PM   #1
loff93
A Fallenroot Satyr
Join Date: Apr 2017
Posts: 25
Cache suggestions

Hello!

Example of my code:

Code:
local Immerseus_LFR = {
	[1] = 104922; -- Hood of swirling senses
}

Immerseus = {
	 [1] = {unpack(Immerseus_LFR)};
}

Siege_Of_Orgrimmar = {
	[1] = {name = "Immerseus", unpack(Immerseus)};
}
When I click show items, it will go through the list and spawn the item name etc, but when the item isn't cached it won't show up. Currently I don't have a good way that refreshes/grabs all the items it's going to show.
Any suggestions/tips on how to solve this?
I can't have the addon caching every table when you login because it will be too many tables & data in the end (I assume), so a better way would be:
When you click the "raid". Cache the items -> show items.
Or
Have a "Grab Items" button that you click when you want to use the addon maybe(?)

Have used this for single items earlier but not quite sure how to tweak it for the best solution. I might find a good solution once I know the best way to deal with cache in this situation.
Not that experienced with LUA.
Code:
local wait = {}
local cache_writer = CreateFrame('Frame')
cache_writer:RegisterEvent('GET_ITEM_INFO_RECEIVED')
cache_writer:SetScript('OnEvent', function(self, event, ...)
    if event == 'GET_ITEM_INFO_RECEIVED' then
        -- the info is now downloaded and cached
        local itemID = ...
		local name = GetItemInfo(itemID) 
        if wait[itemID] then
			-- do something when ID is recieved
            wait[itemID] = nil
			end
    end
end)
Function to show items:
Code:
 function CreateItemList(Instance, Difficulty, newFrame)

Last edited by loff93 : 07-26-17 at 11:07 PM.
  Reply With Quote
 

WoWInterface » Developer Discussions » Lua/XML Help » Cache suggestions

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off