Originally Posted by Ayantir
Hello,
When someone link a book, game use function
Lua Code:
link = ZO_LinkHandler_CreateChatLink(GetLoreBookLink, categoryIndex, collectionIndex, bookIndex)
Where 1rst arg is the fuction itself, aka GetLoreBookLink
Lua Code:
GetLoreBookLink(categoryIndex, collectionIndex, bookIndex)
then it send the link to the chat
But, the link itself is a bit problematic for one of my needs..
cause if you copy the link to your notepad, or whatever, the link will be (ex):
Here, i can recognize the linkhandler format and the internal bookid of the game - 159 (wich is Aedra and Daedra) .. and .. I would like to get the book name.
But impossible to find any trick in the whole game, or LORE_LIBRARY table, or whatever .. is there any people started some researchs here ? I only got the book ID to work or pass as argument, and nothing more.
I searched in few addons code but they all use GetLoreBookLink(categoryIndex, collectionIndex, bookIndex, linkStyle) .. that i cannot access to.
I've also tried to find how the tooltip of the book work and nothing more (because when you clic on the tooltip, game can translate book[159] into "Aedra and Daedra" (and informs you if you know it too!), nothing interesting here too..
PS : I also to hack itemhandler but (per exemple) item 159 does not exist, seems books and items are not reallyon the same table
so if anyone found some interesting things, , thanks in advance !
|
FYI: Book 159 is
Triumphs of a Monarch, Ch. 10,
Aedra and Daedra is 163 (see number in the URL).
I didn't find any function which can translate book number to the title, so the only way is creating lookup table:
Lua Code:
local BOOKSHELF = {}
for categoryID = 1, GetNumLoreCategories() do
local _, numCollections = GetLoreCategoryInfo(categoryID)
for collectionID = 1, numCollections do
local _, _, _, numBooks = GetLoreCollectionInfo(categoryID, collectionID)
for bookID = 1, numBooks do
local title = GetLoreBookInfo(categoryID, collectionID, bookID)
local bookNumber = tonumber((select(4, ZO_LinkHandler_ParseLink(GetLoreBookLink(categoryID, collectionID, bookID, LINK_STYLE_DEFAULT)))))
BOOKSHELF[bookNumber] = title
end
end
end
Creating of this table is pretty fast, so I think it is not a big deal to make it in EVENT_ADD_ON_LOADED event handler.