Quantcast
Download
(1 Kb)
Download
Updated: 08/05/19 08:57 AM
Compatibility:
Scalebreaker (5.1.5)
Elsweyr (5.0.5)
Updated:08/05/19 08:57 AM
Created:07/19/19 09:30 AM
Monthly downloads:1,333
Total downloads:1,499
Favorites:0
MD5:
5.1.5
LibItemsFetcher
Version: 0.0.3
by: zelenin [More]
A library for effective fetching of game items data.

Usage example:
Code:
-- let's get all recipes

local fetcher = LibItemsFetcher:New()

fetcher:RegisterCallback(EVENT_LIB_ITEMS_FETCHER_FETCH_BEGIN, function()
    d("[LibItemsFetcher] Start of recipe scan")
    myAddon.SavedVariables.recipes = {}
end)

-- data = {id = number, name = string, itemType = number ItemType, specializedItemType = number SpecializedItemType}
fetcher:RegisterCallback(EVENT_LIB_ITEMS_FETCHER_ITEM_FETCHED, function(id, isSuccessful, data)
    if id % 10000 == 0 then
        d(string.format("[LibItemsFetcher] Recipe scan - %s", id))
    end

    if isSuccessful == false or data.type ~= ITEMTYPE_RECIPE then
        return
    end

    if myAddon.SavedVariables.recipes[data.specializedItemType] == nil then
        myAddon.SavedVariables.recipes[data.specializedItemType] = {}
    end

    data.itemLink = string.format("|H1:item:%d:364:50:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:10000:0|h|h", data.id)
    data.isKnown = IsItemLinkRecipeKnown(data.itemLink)

    myAddon.SavedVariables.recipes[data.specializedItemType][data.id] = data
end)

fetcher:RegisterCallback(EVENT_LIB_ITEMS_FETCHER_FETCH_END, function(total)
    d("[LibItemsFetcher] End of recipe scan")
end)

fetcher:Fetch()
Version 0.0.3

- Added itemType and specializedItemType fields for consistency. type and specializedType will be removed in 1.0.0

Version 0.0.2

- Added AddOnVersion to addon manifest

Version 0.0.1

- Initial release
Archived Files (2)
File Name
Version
Size
Uploader
Date
0.0.2
1kB
zelenin
07/22/19 09:40 AM
0.0.1
1kB
07/19/19 09:30 AM


Post A Reply Comment Options
Unread 07/22/19, 09:40 AM  
zelenin
AddOn Author - Click to view AddOns

Forum posts: 1
File comments: 51
Uploads: 2
Originally Posted by Baertram
Your manifest txt file is missing the AddOnVersion: <signed integer> value.
You should add it so the game won't load odler versions of your library if the newer one was already loaded before.

Otherwise each loaded file of this library will overwrite the last loaded one and it will not care about the version of the library.
Thanks for report. Updated.
Report comment to moderator  
Reply With Quote
Unread 07/19/19, 09:55 AM  
Baertram
 
Baertram's Avatar
AddOn Author - Click to view AddOns

Forum posts: 2283
File comments: 2519
Uploads: 57
Your manifest txt file is missing the AddOnVersion: <signed integer> value.
You should add it so the game won't load odler versions of your library if the newer one was already loaded before.

Otherwise each loaded file of this library will overwrite the last loaded one and it will not care about the version of the library.
Last edited by Baertram : 07/19/19 at 09:58 AM.
Report comment to moderator  
Reply With Quote
Post A Reply



Category Jump: