diff --git a/CHANGELOG b/CHANGELOG
new file mode 100644
index 0000000..65ae1d2
--- /dev/null
+++ b/CHANGELOG
@@ -0,0 +1,155 @@
+-------------------------------------------------------------------------------
+Librarian v3.0 2022-05-13
+-------------------------------------------------------------------------------
+3.0 2022-05-13
+- Updated API for Ascending Tide (101033)
+- Fix issues
+- Add icons in lore library
+- Add option to mark book as read directly from lore library
+- Remove Import from before patch option which was meant for save created back in 2015
+- Remove some deprecation code for save before 2015
+- Add unreadPerCollection in save in order to know which collection should have an icon in lore library
+- Add deprecation to add these unreadPerCollection flag and the bookId
+- Optimize ImportFromLoreLibrary by removing the Refresh every frame (without it, past 1000 books, the game slow down a lot and at 4000 you end up with less than 1fps)
+- Activate back auto importation from init now that it is quick enough
+- Add full localization and support french language
+- Add a small timer before refreshing the list when doing a research as we could trigger a crash if we were typing a search too fast when we have too many books
+- Improve settings (better integration with LibAddonMenu and add a few options)
+
+2.0 (2/12/18)
+- Updated API for Dragon Bones (100022)
+- Fixed issue with ZOS function LoreReader, and new issue with ZO_SceneManager. Currently closes back to
+UI and not Librarian list, will update that soon.
+
+1.9 (9/10/17)
+- Updated API for Horns Of The Reach (100020)
+- Updated LAM to 2.0 r24
+- Fixed issue with ZOS function LoreReader
+
+1.8 (6/10/17)
+- Updated API for Morrowind (100019)
+
+1.7 (2/5/17)
+- Updated LAM to 2.0 r23
+- Updated to API 18 (Homestead)
+
+1.6.3 2016-09-10
+- Import feature working much better thanks some input from Votan (Thank You!)
+
+1.6.2 2016-09-10
+- Updated to LibAddonMenu 2.0 r17
+- Updated for Shadows of the Hist, API 100016, also confirmed working for 100017
+TODO: Looking at building language localizations and some category filters for book types. Also looking at improving the import function.
+
+1.6.1
+- Added License for LibAddonMenu
+
+1.6.0
+- Updated TOC for Tamriel Unlimited
+- Updated LibAddonMenu
+
+1.5.0
+- Updated TOC for patch 1.5
+- Updated LibAddonMenu 2.0
+
+1.4.0
+- Updated TOC for patch 1.4
+
+1.2.6 2014-9-5
+- Added an option to disable the character spin when opening the Librarian window.
+- Added a shortcut button to the setting window in the top right of Librarian.
+- Compatibility fixes for version 1.4 from the PTS.
+
+1.2.5 2014-8-18
+- Exiting the book reader interface now returns to Librarian rather than the base scene. Also fixes this behaviour with books opened from the inventory and the lore library.
+
+1.2.4 2014-8-15
+- Modified the SavedVariable import process to fix data for all accounts, not just the currently logged-in account.
+
+1.2.3 2014-8-6
+- Added missing references to LibAddonMenu.lua files that was causing an error.
+
+1.2.2 2014-8-6
+- Fixed a bug where full-text search would show an error if a book was missing its body.
+
+1.2.1 2014-8-5
+- Fixed a error caused by a change to the Scene Manager in 1.3
+- Added a function to migrate data from the "empty" account that was created by the GetDisplayName() bug in 1.2.3
+
+1.2.0 2014-6-25
+- Updated to LibAddonMenu 2.0.
+- Added a SavedVariable backup reminder.
+
+1.1.2 2014-6-24
+- Fixed a bug with the "Waterlogged Journal" from Craglorn that was caused a user to lose all their data. A more robust fix will be deployed later.
+
+1.1.1 2014-6-14
+- Temporarily disabled integration with the LoreLibrary which was causing connection time-outs for some users. This feature will be re-enabled when a fix for it is found.
+
+1.1.0 2014-5-23
+- Update API version to 100004. Addon appears to be stable, so I have moved to version 1.1.0.
+
+1.0.18 2014-5-8
+- Fixed a bug with upgrading old databases that would result in an error.
+
+1.0.17 2014-5-7
+- Fixed a bug in the settings panel when a newer version of LibAddonMenu was loaded.
+- Updated the bundled version of LibAddonMenu to 1.0r7
+
+1.0.16 2014-5-5
+- Added a new optional reloadui reminder feature. By default, after finding 5 new books the game reminds you in a chat message to reloadui so that you do not lose much progress in the case of a crash.
+- Fixed a bug with non-english clients that was preventing keybindings from working.
+- Added the current version number to the UI.
+
+1.0.15 2014-4-30
+- Fixed an error that occurred when viewing a book that was not already in the collection.
+
+1.0.14 2014-4-30
+- Added a new unread indicator to the book reader. The indicator can be disabled in the settings.
+
+1.0.13 2014-4-30
+- Added the ability to toggle a book's unread status while reading it.
+
+1.0.12 2014-4-29
+- Added full-text search feature.
+
+1.0.11 2014-4-28
+- Added the LoreLibrary import feature.
+- Fixed a error when changing the time display setting.
+
+1.0.10 2014-4-28
+- Fixed an error that was occurring when upgrading users of an older version of Librarian. Sorry I missed that!
+
+1.0.9 2014-4-25
+- From user feedback, performance looks to have been fixed! Moving back onto features.
+- Added an unread book counter
+
+1.0.8 2014-4-24
+- Completely revamped the code to use ZO_SortFilterList as the basis of the Librarian book list. Hopefully performance is significantly improved, both for scrolling, and loading / exiting the game.
+
+1.0.7 2014-4-21
+- Added a setting to specify whether or not to display alerts in chat and/or as a banner-type alert.
+
+1.0.6 2014-4-17
+- Fixed a bug with the keybinding unread / read display when a book is highlighted.
+- Replaced the chat alert when finding a new book with an alert similar to when finding a new lore book.
+
+1.0.5 2014-4-17
+- Fixed a bug with toggling the read / unread status of books.
+
+1.0.4 2014-4-17
+- Account-wide book access. There is a checkbox available at the bottom of the Librarian interface to toggle the showing of books seen across any of your characters. Initially, you will need to log in each character once to move their data to the account-wide Library.
+- Big changes on the data storage side. Actual book data is stored in an account-wide variable, and only the time found is stored per-character.
+
+1.0.3 2014-4-15
+- Added a settings screen which can be accessed from the standard settings menu.
+- Added a time format setting so the user can choose between 12 and 24 hour time. This setting should default to 12 hour for english and 24 hour for other languages, which is the same logic the game itself uses.
+- Fixed the bug where times were always being displayed as "P.M."
+
+1.0.2 2014-4-14
+- Added a book count header.
+- Fixed a bug with highlighting of sort headers.
+- Known issue: book found times are still inconsistent.
+
+1.0.1 2014-4-13
+- Added a wordcount field.
\ No newline at end of file
diff --git a/Changelog b/Changelog
deleted file mode 100644
index 65ae1d2..0000000
--- a/Changelog
+++ /dev/null
@@ -1,155 +0,0 @@
--------------------------------------------------------------------------------
-Librarian v3.0 2022-05-13
--------------------------------------------------------------------------------
-3.0 2022-05-13
-- Updated API for Ascending Tide (101033)
-- Fix issues
-- Add icons in lore library
-- Add option to mark book as read directly from lore library
-- Remove Import from before patch option which was meant for save created back in 2015
-- Remove some deprecation code for save before 2015
-- Add unreadPerCollection in save in order to know which collection should have an icon in lore library
-- Add deprecation to add these unreadPerCollection flag and the bookId
-- Optimize ImportFromLoreLibrary by removing the Refresh every frame (without it, past 1000 books, the game slow down a lot and at 4000 you end up with less than 1fps)
-- Activate back auto importation from init now that it is quick enough
-- Add full localization and support french language
-- Add a small timer before refreshing the list when doing a research as we could trigger a crash if we were typing a search too fast when we have too many books
-- Improve settings (better integration with LibAddonMenu and add a few options)
-
-2.0 (2/12/18)
-- Updated API for Dragon Bones (100022)
-- Fixed issue with ZOS function LoreReader, and new issue with ZO_SceneManager. Currently closes back to
-UI and not Librarian list, will update that soon.
-
-1.9 (9/10/17)
-- Updated API for Horns Of The Reach (100020)
-- Updated LAM to 2.0 r24
-- Fixed issue with ZOS function LoreReader
-
-1.8 (6/10/17)
-- Updated API for Morrowind (100019)
-
-1.7 (2/5/17)
-- Updated LAM to 2.0 r23
-- Updated to API 18 (Homestead)
-
-1.6.3 2016-09-10
-- Import feature working much better thanks some input from Votan (Thank You!)
-
-1.6.2 2016-09-10
-- Updated to LibAddonMenu 2.0 r17
-- Updated for Shadows of the Hist, API 100016, also confirmed working for 100017
-TODO: Looking at building language localizations and some category filters for book types. Also looking at improving the import function.
-
-1.6.1
-- Added License for LibAddonMenu
-
-1.6.0
-- Updated TOC for Tamriel Unlimited
-- Updated LibAddonMenu
-
-1.5.0
-- Updated TOC for patch 1.5
-- Updated LibAddonMenu 2.0
-
-1.4.0
-- Updated TOC for patch 1.4
-
-1.2.6 2014-9-5
-- Added an option to disable the character spin when opening the Librarian window.
-- Added a shortcut button to the setting window in the top right of Librarian.
-- Compatibility fixes for version 1.4 from the PTS.
-
-1.2.5 2014-8-18
-- Exiting the book reader interface now returns to Librarian rather than the base scene. Also fixes this behaviour with books opened from the inventory and the lore library.
-
-1.2.4 2014-8-15
-- Modified the SavedVariable import process to fix data for all accounts, not just the currently logged-in account.
-
-1.2.3 2014-8-6
-- Added missing references to LibAddonMenu.lua files that was causing an error.
-
-1.2.2 2014-8-6
-- Fixed a bug where full-text search would show an error if a book was missing its body.
-
-1.2.1 2014-8-5
-- Fixed a error caused by a change to the Scene Manager in 1.3
-- Added a function to migrate data from the "empty" account that was created by the GetDisplayName() bug in 1.2.3
-
-1.2.0 2014-6-25
-- Updated to LibAddonMenu 2.0.
-- Added a SavedVariable backup reminder.
-
-1.1.2 2014-6-24
-- Fixed a bug with the "Waterlogged Journal" from Craglorn that was caused a user to lose all their data. A more robust fix will be deployed later.
-
-1.1.1 2014-6-14
-- Temporarily disabled integration with the LoreLibrary which was causing connection time-outs for some users. This feature will be re-enabled when a fix for it is found.
-
-1.1.0 2014-5-23
-- Update API version to 100004. Addon appears to be stable, so I have moved to version 1.1.0.
-
-1.0.18 2014-5-8
-- Fixed a bug with upgrading old databases that would result in an error.
-
-1.0.17 2014-5-7
-- Fixed a bug in the settings panel when a newer version of LibAddonMenu was loaded.
-- Updated the bundled version of LibAddonMenu to 1.0r7
-
-1.0.16 2014-5-5
-- Added a new optional reloadui reminder feature. By default, after finding 5 new books the game reminds you in a chat message to reloadui so that you do not lose much progress in the case of a crash.
-- Fixed a bug with non-english clients that was preventing keybindings from working.
-- Added the current version number to the UI.
-
-1.0.15 2014-4-30
-- Fixed an error that occurred when viewing a book that was not already in the collection.
-
-1.0.14 2014-4-30
-- Added a new unread indicator to the book reader. The indicator can be disabled in the settings.
-
-1.0.13 2014-4-30
-- Added the ability to toggle a book's unread status while reading it.
-
-1.0.12 2014-4-29
-- Added full-text search feature.
-
-1.0.11 2014-4-28
-- Added the LoreLibrary import feature.
-- Fixed a error when changing the time display setting.
-
-1.0.10 2014-4-28
-- Fixed an error that was occurring when upgrading users of an older version of Librarian. Sorry I missed that!
-
-1.0.9 2014-4-25
-- From user feedback, performance looks to have been fixed! Moving back onto features.
-- Added an unread book counter
-
-1.0.8 2014-4-24
-- Completely revamped the code to use ZO_SortFilterList as the basis of the Librarian book list. Hopefully performance is significantly improved, both for scrolling, and loading / exiting the game.
-
-1.0.7 2014-4-21
-- Added a setting to specify whether or not to display alerts in chat and/or as a banner-type alert.
-
-1.0.6 2014-4-17
-- Fixed a bug with the keybinding unread / read display when a book is highlighted.
-- Replaced the chat alert when finding a new book with an alert similar to when finding a new lore book.
-
-1.0.5 2014-4-17
-- Fixed a bug with toggling the read / unread status of books.
-
-1.0.4 2014-4-17
-- Account-wide book access. There is a checkbox available at the bottom of the Librarian interface to toggle the showing of books seen across any of your characters. Initially, you will need to log in each character once to move their data to the account-wide Library.
-- Big changes on the data storage side. Actual book data is stored in an account-wide variable, and only the time found is stored per-character.
-
-1.0.3 2014-4-15
-- Added a settings screen which can be accessed from the standard settings menu.
-- Added a time format setting so the user can choose between 12 and 24 hour time. This setting should default to 12 hour for english and 24 hour for other languages, which is the same logic the game itself uses.
-- Fixed the bug where times were always being displayed as "P.M."
-
-1.0.2 2014-4-14
-- Added a book count header.
-- Fixed a bug with highlighting of sort headers.
-- Known issue: book found times are still inconsistent.
-
-1.0.1 2014-4-13
-- Added a wordcount field.
\ No newline at end of file
diff --git a/Librarian.lua b/Librarian.lua
index dd0cd04..faaa1a5 100644
--- a/Librarian.lua
+++ b/Librarian.lua
@@ -27,7 +27,7 @@ end
function Librarian:Initialize(...)
ZO_SortFilterList.Initialize(self, ...)
-
+
self.masterList = {}
self.newBookCount = 0
self.sortHeaderGroup:SelectHeaderByKey("timeStamp")
@@ -35,7 +35,7 @@ function Librarian:Initialize(...)
ZO_ScrollList_AddDataType(self.list, LIBRARIAN_DATA, "LibrarianBookRow", 30, function(control, data) self:SetupBookRow(control, data) end)
ZO_ScrollList_EnableHighlight(self.list, "ZO_ThinListHighlight")
- self.localSavedVars = ZO_SavedVars:New("Librarian_SavedVariables", 2, nil, self.defaults, nil)
+ self.localSavedVars = ZO_SavedVars:New("Librarian_SavedVariables", 1, nil, self.defaults, nil)
self.globalSavedVars = ZO_SavedVars:NewAccountWide("Librarian_SavedVariables", 1, nil, self.defaults, nil)
if not self.globalSavedVars.settings then self.globalSavedVars.settings = {} end
@@ -48,7 +48,6 @@ function Librarian:Initialize(...)
self.characterBooks = self.localSavedVars.characterBooks
self.characterBooksCache = {}
- if not self.localSavedVars.unreadPerCollections then self.localSavedVars.unreadPerCollections = {} end
self.unreadPerCollections = self.localSavedVars.unreadPerCollections
self.searchBox = GetControl(LibrarianFrame, "SearchBox")
@@ -75,12 +74,13 @@ function Librarian:Initialize(...)
ZO_CheckButton_SetToggleFunction(showAllBooks, OnShowAllBooksClicked)
ZO_CheckButton_SetCheckState(showAllBooks, GetShowAllBooks())
- self:ImportFromLoreLibrary()
self:RefreshData()
self:InitializeKeybindStripDescriptors()
self:InitializeScene()
self:AddLoreReaderUnreadToggle()
self:AddLoreLibraryIcons()
+
+ self:ImportFromLoreLibrary()
end
function Librarian:AddLoreReaderUnreadToggle()
@@ -133,7 +133,7 @@ function Librarian:AddLoreLibraryIcons()
if not self.settings.showUnreadIndicatorInLoreLibrary then
return
end
-
+
-- ADD UNREAD ICON ON EACH ENTRY UNREAD
local BOOK_DATA_TYPE = 1
local scrollList = LORE_LIBRARY.list:GetListControl()
@@ -142,7 +142,7 @@ function Librarian:AddLoreLibraryIcons()
local function SetUpBookEntry(control, data)
initalDataType.setupCallback(control, data)
-
+
local title, _, known = GetLoreBookInfo(data.categoryIndex, data.collectionIndex, data.bookIndex)
local shouldUnreadIconBeHidden = true
if known then
@@ -153,19 +153,45 @@ function Librarian:AddLoreLibraryIcons()
end
control:GetNamedChild("UnreadIcon"):SetHidden(shouldUnreadIconBeHidden)
end
-
+
ZO_ScrollList_AddDataType(scrollList, BOOK_DATA_TYPE, "Librarian_LoreLibrary_BookEntry", initalDataType.height, SetUpBookEntry)
-
+
+ -- ORDER BOOK LIST TO MAKE UNREAD BOOK FIRST
+ local function BookEntryComparator(leftScrollData, rightScrollData)
+ local leftData = leftScrollData.data
+ local rightData = rightScrollData.data
+ local leftTitle, _, leftKnown = GetLoreBookInfo(leftData.categoryIndex, leftData.collectionIndex, leftData.bookIndex)
+ local rightTitle, _, rightKnown = GetLoreBookInfo(rightData.categoryIndex, rightData.collectionIndex, rightData.bookIndex)
+
+ if leftKnown == rightKnown then
+ if leftKnown then
+ local leftBook = self:FindBook(leftTitle)
+ local rightBook = self:FindBook(rightTitle)
+ if (leftBook and not leftBook.unread) == (rightBook and not rightBook.unread) then
+ return leftTitle < rightTitle
+ end
+
+ return leftBook and leftBook.unread
+ end
+ end
+
+ return leftKnown
+ end
+ LORE_LIBRARY.list.SortScrollList = function(loreLibrarySelf)
+ local scrollData = ZO_ScrollList_GetDataList(loreLibrarySelf.list)
+ table.sort(scrollData, BookEntryComparator)
+ end
+
-- ADD KEYBIND TO MARK BOOK AS READ FROM LORE LIBRARY
local loreLibraryKeybinds = LORE_LIBRARY.keybindStripDescriptor
-
+
-- Make current secondary tertiary
for i, keybindDescriptor in ipairs(loreLibraryKeybinds) do
if keybindDescriptor.keybind == "UI_SHORTCUT_SECONDARY" then
keybindDescriptor.keybind = "UI_SHORTCUT_TERTIARY"
end
end
-
+
local toggleKeybind =
{
alignment = KEYBIND_STRIP_ALIGN_RIGHT,
@@ -195,7 +221,7 @@ function Librarian:AddLoreLibraryIcons()
book = { title = selectedRow.text:GetText(), body = body, medium = medium, showTitle = showTitle, bookId = bookId }
self:AddBook(book, true)
end
-
+
if book then
self:ToggleReadBook(book)
KEYBIND_STRIP:UpdateKeybindButtonGroup(loreLibraryKeybinds)
@@ -205,11 +231,11 @@ function Librarian:AddLoreLibraryIcons()
end
}
table.insert(loreLibraryKeybinds, toggleKeybind)
-
+
-- ADD UNREAD ICON ON COLLECTION IF IT CONTAINS AN UNREAD BOOK
local navigationEntryTemplateInfo = LORE_LIBRARY.navigationTree.templateInfo["ZO_LoreLibraryNavigationEntry"]
local previousSetupFunction = navigationEntryTemplateInfo.setupFunction
-
+
local function TreeEntrySetup(node, control, data, open)
previousSetupFunction(node, control, data, open)
@@ -228,45 +254,50 @@ function Librarian:AddLoreLibraryIcons()
end
statusIcon:SetHidden(shouldHideIcon)
end
-
+
navigationEntryTemplateInfo.setupFunction = TreeEntrySetup
navigationEntryTemplateInfo.template = "Librarian_LoreLibraryNavigationEntry"
navigationEntryTemplateInfo.objectPool.templateName = "Librarian_LoreLibraryNavigationEntry"
-
+
-- Fix of ESO because a label header is equal to all of its entries with the current code (API 101033)
LORE_LIBRARY.navigationTree.templateInfo["ZO_LabelHeader"].equalityFunction = navigationEntryTemplateInfo.equalityFunction
end
function Librarian:UpdateSavedVariables()
- -- before version 2, unreadPerCollections didn't exist and bookId wasn't set
- if self.localSavedVars.version < 2 then
- local GetLoreBookInfo, ReadLoreBook = GetLoreBookInfo, ReadLoreBook
- local categoryIndex, collectionIndex, bookIndex = 0, 0, 0
- local numCollections, totalBooks = 0, 0
- while true do
- if bookIndex >= totalBooks then
- if collectionIndex >= numCollections then
- if categoryIndex >= GetNumLoreCategories() then
- endSearch()
- break
- else
- categoryIndex = categoryIndex + 1
- local loreCategoryName
- numCollections = select(2, GetLoreCategoryInfo(categoryIndex))
- collectionIndex = 0
+ -- before version 3.0, unreadPerCollections didn't exist and bookId wasn't set
+ if not self.unreadPerCollections then
+ self.localSavedVars.unreadPerCollections = {}
+ self.unreadPerCollections = self.localSavedVars.unreadPerCollections
+
+ -- if this character doesn't know any book yet, no need to go further
+ if next(self.characterBooks) ~= nil then
+ local GetLoreBookInfo, ReadLoreBook = GetLoreBookInfo, ReadLoreBook
+ local categoryIndex, collectionIndex, bookIndex = 0, 0, 0
+ local numCollections, totalBooks = 0, 0
+ while true do
+ if bookIndex >= totalBooks then
+ if collectionIndex >= numCollections then
+ if categoryIndex >= GetNumLoreCategories() then
+ break
+ else
+ categoryIndex = categoryIndex + 1
+ local loreCategoryName
+ numCollections = select(2, GetLoreCategoryInfo(categoryIndex))
+ collectionIndex = 0
+ end
end
+ collectionIndex = collectionIndex + 1
+ totalBooks = select(4, GetLoreCollectionInfo(categoryIndex, collectionIndex))
+ bookIndex = 0
end
- collectionIndex = collectionIndex + 1
- totalBooks = select(4, GetLoreCollectionInfo(categoryIndex, collectionIndex))
- bookIndex = 0
- end
- bookIndex = bookIndex + 1
- local title, icon, known, bookId = GetLoreBookInfo(categoryIndex, collectionIndex, bookIndex)
- book = self:FindBook(title)
- if book then
- book.bookId = bookId
- if known and book.unread then
- self:AddUnreadBookInCollection(categoryIndex, collectionIndex)
+ bookIndex = bookIndex + 1
+ local title, icon, known, bookId = GetLoreBookInfo(categoryIndex, collectionIndex, bookIndex)
+ book = self:FindBook(title)
+ if book then
+ book.bookId = bookId
+ if known and book.unread and self:FindCharacterBook(title, bookId) then
+ self:AddUnreadBookInCollection(categoryIndex, collectionIndex)
+ end
end
end
end
@@ -386,7 +417,7 @@ function Librarian:ImportFromLoreLibrary()
end
return true
end
-
+
local function steps()
local gettime = GetGameTimeMilliseconds
local start = gettime()
@@ -437,7 +468,7 @@ function Librarian:FilterScrollList()
if data.unread then unreadCount = unreadCount + 1 end
end
end
- end
+ end
local message = string.format(GetString(LIBRARIAN_BOOK_COUNT), bookCount)
if unreadCount > 0 then message = string.format(GetString(LIBRARIAN_UNREAD_COUNT), message, unreadCount) end
@@ -455,7 +486,7 @@ function Librarian:SetupBookRow(control, data)
control.found = GetControl(control, "Found")
control.title = GetControl(control, "Title")
control.wordCount = GetControl(control, "WordCount")
-
+
control.unread.nonRecolorable = true
if data.unread then control.unread:SetAlpha(1) else control.unread:SetAlpha(0) end
@@ -489,11 +520,11 @@ function Librarian:FindCharacterBook(title, bookId)
if not self.characterBooks then
return nil
end
-
+
if bookId and self.characterBooksCache[bookId] then
return self.characterBooksCache[bookId]
end
-
+
for _,book in pairs(self.characterBooks) do
if book.title == title then
if bookId then
@@ -502,7 +533,7 @@ function Librarian:FindCharacterBook(title, bookId)
return book
end
end
-
+
return nil
end
@@ -528,20 +559,22 @@ function Librarian:AddBook(book, refreshDataRightAway)
newBody = string.sub(newBody, 1025)
end
table.insert(book.body, newBody)
-
+
table.insert(self.books, book)
-
- local categoryIndex, collectionIndex = GetLoreBookIndicesFromBookId(book.bookId)
- self:AddUnreadBookInCollection(categoryIndex, collectionIndex)
end
local characterBook = { title = book.title, timeStamp = GetTimeStamp() }
table.insert(self.characterBooks, characterBook)
-
+
+ if book.unread then
+ local categoryIndex, collectionIndex = GetLoreBookIndicesFromBookId(book.bookId)
+ self:AddUnreadBookInCollection(categoryIndex, collectionIndex)
+ end
+
if refreshDataRightAway then
self:RefreshAllData()
end
-
+
if self.settings.alertEnabled then
--CENTER_SCREEN_ANNOUNCE:AddMessage(EVENT_SKILL_RANK_UPDATE, CSA_EVENT_LARGE_TEXT, SOUNDS.BOOK_ACQUIRED, GetString(SI_LIBRARIAN_NEW_BOOK_FOUND))
local params = CENTER_SCREEN_ANNOUNCE:CreateMessageParams(CSA_EVENT_LARGE_TEXT, SOUNDS.BOOK_ACQUIRED)
@@ -568,7 +601,7 @@ end
function Librarian:ToggleReadBook(book)
book.unread = not book.unread
-
+
local categoryIndex, collectionIndex = GetLoreBookIndicesFromBookId(book.bookId)
if categoryIndex and collectionIndex then
if not self.unreadPerCollections[categoryIndex] then self.unreadPerCollections[categoryIndex] = {} end
@@ -593,13 +626,13 @@ function Librarian:ReadBook(title)
local book = self:FindBook(title)
LORE_READER:SetupBook(book.title, book.body and table.concat(book.body), book.medium, book.showTitle)
SCENE_MANAGER:Push("loreReaderInteraction")
-
+
-- PlaySound(LORE_READER.OpenSound)
end
function Librarian:RefreshAllData()
self:RefreshData()
-
+
if self.settings.showUnreadIndicatorInLoreLibrary then
local selectedCategoryIndex = LORE_LIBRARY:GetSelectedCategoryIndex()
local selectedCollectionIndex = LORE_LIBRARY:GetSelectedCollectionIndex()
@@ -624,7 +657,7 @@ end
function Librarian:OnSearchTextChanged()
ZO_EditDefaultText_OnTextChanged(self.searchBox)
-
+
-- Let's wait a little bit before updating the filters if the player didn't have time to enter its full string yet
-- Because if we try to update the filters too much it sometimes crash
local TIME_BEFORE_UPDATING_FILTERS = 600 -- ms
diff --git a/Librarian.txt b/Librarian.txt
index 1ab415d..7047da9 100644
--- a/Librarian.txt
+++ b/Librarian.txt
@@ -1,5 +1,5 @@
## Title: Librarian
-## Author: |c4EFFF6Calia1120|r, Flamage, Orionik
+## Author: Orionik, |c4EFFF6Calia1120|r, Flamage
## Version: 1.0
## APIVersion: 101033
## SavedVariables: Librarian_SavedVariables