diff --git a/Deprecation.lua b/Deprecation.lua index a3456f6..c92b36b 100644 --- a/Deprecation.lua +++ b/Deprecation.lua @@ -204,10 +204,10 @@ function Librarian:UpdateSavedVariables() book.body = nil book.medium = nil book.showTitle = nil - book.wordCount = nil else book.bookId = self:GetBookIdWithTitle(book.title) end + book.wordCount = nil -- it will be computed when building the list (it will allow to switch language and this will still be acurate) end end end diff --git a/Librarian.lua b/Librarian.lua index d4e8663..34b03e1 100644 --- a/Librarian.lua +++ b/Librarian.lua @@ -322,6 +322,19 @@ function Librarian:InitializeKeybindStripDescriptors() local book = self:FindBook(self.mouseOverRow.data.bookId) self:ToggleReadBook(book) end, + }, + { + alignment = KEYBIND_STRIP_ALIGN_RIGHT, + name = GetString(LIBRARIAN_GO_TO_CATEGORY), + keybind = "UI_SHORTCUT_TERTIARY", + visible = function() + return self.mouseOverRow and self.mouseOverRow.data.categoryIndex and self.mouseOverRow.data.collectionIndex + end, + callback = function() + local collectionId = select(7, GetLoreCollectionInfo(self.mouseOverRow.data.categoryIndex, self.mouseOverRow.data.collectionIndex)) + LORE_LIBRARY:SetCollectionIdToSelect(collectionId) + MAIN_MENU_KEYBOARD:ShowScene("loreLibrary") + end, } } end @@ -454,10 +467,13 @@ function Librarian:BuildMasterList() if not data.categoryIndex or not data.collectionIndex or not data.bookIndex then data.categoryIndex, data.collectionIndex, data.bookIndex = GetLoreBookIndicesFromBookId(book.bookId) end - if data.categoryIndex and data.collectionIndex and data.bookIndex and (not data.title or not data.body or not data.wordCount) then + if data.categoryIndex and data.collectionIndex and data.bookIndex and (not data.title or not data.body or not data.category) then data.title = GetLoreBookInfo(data.categoryIndex, data.collectionIndex, data.bookIndex) data.body = ReadLoreBook(data.categoryIndex, data.collectionIndex, data.bookIndex) + data.category = GetLoreCollectionInfo(data.categoryIndex, data.collectionIndex) + end + if not data.wordCount then local wordCount = 0 if data.body then for w in data.body:gmatch("%S+") do @@ -514,6 +530,7 @@ function Librarian:SetupBookRow(control, data) control.unread = GetControl(control, "Unread") control.found = GetControl(control, "Found") control.title = GetControl(control, "Title") + control.category = GetControl(control, "Category") control.wordCount = GetControl(control, "WordCount") control.unread.nonRecolorable = true @@ -525,6 +542,13 @@ function Librarian:SetupBookRow(control, data) control.title.normalColor = ZO_NORMAL_TEXT control.title:SetText(data.title) + control.category.normalColor = ZO_NORMAL_TEXT + if data.category then + control.category:SetText(data.category) + else + control.category:SetText(GetString(LIBRARIAN_NO_CATEGORY)) + end + control.wordCount.normalColor = ZO_NORMAL_TEXT control.wordCount:SetText(data.wordCount) @@ -583,7 +607,14 @@ function Librarian:AddBookToGlobalSave(book) book.body = nil book.medium = nil book.showTitle = nil - book.wordCount = nil + else + local newBody = book.body + book.body = {} + while string.len(newBody) > 1024 do + table.insert(book.body, string.sub(newBody, 0, 1024)) + newBody = string.sub(newBody, 1025) + end + table.insert(book.body, newBody) end table.insert(self.books, book) diff --git a/Librarian.txt b/Librarian.txt index cef9927..17f0cd3 100644 --- a/Librarian.txt +++ b/Librarian.txt @@ -1,7 +1,7 @@ ## Title: Librarian ## Author: Orionik, |c4EFFF6Calia1120|r, Flamage ## Version: 1.0 -## APIVersion: 101033 +## APIVersion: 101034 ## SavedVariables: Librarian_SavedVariables ## DependsOn: LibAddonMenu-2.0 diff --git a/Librarian.xml b/Librarian.xml index e24c405..a9fc1bb 100644 --- a/Librarian.xml +++ b/Librarian.xml @@ -14,17 +14,20 @@ </OnMouseUp> <Controls> <Texture name="$(parent)Unread" textureFile="EsoUI/Art/Inventory/newitem_icon.dds"> - <Dimensions x="32" y="32" /> + <Dimensions x="30" y="30" /> <Anchor point="TOPLEFT" relativeTo="$(parent)" offsetX="19" /> </Texture> - <Label name="$(parent)Found" font="ZoFontWinH2" wrapMode="ELLIPSIS"> - <Anchor point="TOPLEFT" relativeTo="$(parent)" offsetX="90" offsetY="1" /> + <Label name="$(parent)Found" font="ZoFontWinH3" wrapMode="ELLIPSIS"> + <Anchor point="TOPLEFT" relativeTo="$(parent)" offsetX="70" offsetY="1" /> </Label> - <Label name="$(parent)WordCount" font="ZoFontWinH2" wrapMode="ELLIPSIS"> + <Label name="$(parent)WordCount" font="ZoFontWinH3" wrapMode="ELLIPSIS"> <Anchor point="TOPRIGHT" relativeTo="$(parent)" offsetY="1" /> </Label> - <Label name="$(parent)Title" font="ZoFontWinH2" wrapMode="ELLIPSIS"> - <Anchor point="TOPLEFT" relativeTo="$(parent)" offsetX="290" offsetY="1" /> + <Label name="$(parent)Category" font="ZoFontWinH3" wrapMode="ELLIPSIS"> + <Anchor point="TOPLEFT" relativeTo="$(parent)" offsetX="650" offsetY="1" /> + </Label> + <Label name="$(parent)Title" font="ZoFontWinH3" wrapMode="ELLIPSIS"> + <Anchor point="TOPLEFT" relativeTo="$(parent)" offsetX="200" offsetY="1" /> </Label> </Controls> </Button> @@ -70,14 +73,14 @@ ZO_SortHeader_Initialize(self, GetString(LIBRARIAN_SORT_TYPE_UNREAD), "unread", ZO_SORT_ORDER_DOWN, TEXT_ALIGN_LEFT, "ZoFontGameLargeBold") </OnInitialized> <Anchor point="TOPLEFT" /> - <Dimensions x="90" y="32" /> + <Dimensions x="70" y="32" /> </Control> <Control name="$(parent)Found" inherits="ZO_SortHeader"> <OnInitialized> ZO_SortHeader_Initialize(self, GetString(LIBRARIAN_SORT_TYPE_FOUND), "timeStamp", ZO_SORT_ORDER_DOWN, TEXT_ALIGN_LEFT, "ZoFontGameLargeBold") </OnInitialized> <Anchor point="TOPLEFT" relativeTo="$(parent)Unread" relativePoint="TOPRIGHT" /> - <Dimensions x="200" y="32" /> + <Dimensions x="130" y="32" /> </Control> <Control name="$(parent)WordCount" inherits="ZO_SortHeader"> <OnInitialized> @@ -86,12 +89,19 @@ <Anchor point="TOPRIGHT" /> <Dimensions x="80" y="32" /> </Control> + <Control name="$(parent)Category" inherits="ZO_SortHeader"> + <OnInitialized> + ZO_SortHeader_Initialize(self, GetString(LIBRARIAN_SORT_TYPE_CATEGORY), "category", ZO_SORT_ORDER_UP, TEXT_ALIGN_LEFT, "ZoFontGameLargeBold") + </OnInitialized> + <Anchor point="TOPRIGHT" relativeTo="$(parent)WordCount" relativePoint="TOPLEFT" /> + <Dimensions x="200" y="32" /> + </Control> <Control name="$(parent)Title" inherits="ZO_SortHeader"> <OnInitialized> ZO_SortHeader_Initialize(self, GetString(LIBRARIAN_SORT_TYPE_TITLE), "title", ZO_SORT_ORDER_UP, TEXT_ALIGN_LEFT, "ZoFontGameLargeBold") </OnInitialized> <Anchor point="TOPLEFT" relativeTo="$(parent)Found" relativePoint="TOPRIGHT" /> - <Anchor point="TOPRIGHT" relativeTo="$(parent)WordCount" relativePoint="TOPLEFT" /> + <Anchor point="TOPRIGHT" relativeTo="$(parent)Category" relativePoint="TOPLEFT" /> <Dimensions y="32" /> </Control> </Controls> diff --git a/lang/en.lua b/lang/en.lua index e168aa7..32d8c02 100644 --- a/lang/en.lua +++ b/lang/en.lua @@ -8,6 +8,7 @@ local strings = { LIBRARIAN_SORT_TYPE_UNREAD = "Unread", LIBRARIAN_SORT_TYPE_FOUND = "Found", LIBRARIAN_SORT_TYPE_TITLE = "Title", + LIBRARIAN_SORT_TYPE_CATEGORY = "Category", LIBRARIAN_SORT_TYPE_WORD_COUNT = "Words", LIBRARIAN_MARK_UNREAD = "Mark as Unread", LIBRARIAN_MARK_READ = "Mark as Read", @@ -18,6 +19,8 @@ local strings = { LIBRARIAN_NEW_BOOK_FOUND_WITH_TITLE = "Book added to librarian: %s", LIBRARIAN_FULLTEXT_SEARCH = "Full-text Search:", LIBRARIAN_SEARCH_HINT = "Enter text to search for.", + LIBRARIAN_NO_CATEGORY = "No Category", + LIBRARIAN_GO_TO_CATEGORY = "Go to Category", LIBRARIAN_RELOAD_REMINDER = "ReloadUI suggested to update Librarian database.", LIBRARIAN_BACKUP_REMINDER = "Remember to backup your Librarian SavedVariables regularly. Look up Librarian on ESOUI for instructions.", diff --git a/lang/fr.lua b/lang/fr.lua index abc15a5..98bc7ab 100644 --- a/lang/fr.lua +++ b/lang/fr.lua @@ -5,6 +5,7 @@ SafeAddString(LIBRARIAN_WINDOW_TITLE_LIBRARIAN, "Librarian", 1) SafeAddString(LIBRARIAN_SORT_TYPE_UNREAD, "Non lu", 1) SafeAddString(LIBRARIAN_SORT_TYPE_FOUND, "Trouvé", 1) SafeAddString(LIBRARIAN_SORT_TYPE_TITLE, "Titre", 1) +SafeAddString(LIBRARIAN_SORT_TYPE_CATEGORY, "Catégorie", 1) SafeAddString(LIBRARIAN_SORT_TYPE_WORD_COUNT, "Nb Mots", 1) SafeAddString(LIBRARIAN_MARK_UNREAD, "Marquer comme lu", 1) SafeAddString(LIBRARIAN_MARK_READ, "Marquer comme non lu", 1) @@ -15,6 +16,8 @@ SafeAddString(LIBRARIAN_NEW_BOOK_FOUND, "Livre ajouté à Librarian", 1) SafeAddString(LIBRARIAN_NEW_BOOK_FOUND_WITH_TITLE, "Livre ajouté à Librarian: %s", 1) SafeAddString(LIBRARIAN_FULLTEXT_SEARCH, "Recherche:", 1) SafeAddString(LIBRARIAN_SEARCH_HINT, "Texte à rechercher.", 1) +SafeAddString(LIBRARIAN_NO_CATEGORY, "Pas de catégorie", 1) +SafeAddString(LIBRARIAN_GO_TO_CATEGORY, "Ouvrir la catégorie", 1) SafeAddString(LIBRARIAN_RELOAD_REMINDER, "ReloadUI conseillé pour mettre à jour les données de Librarian.", 1) SafeAddString(LIBRARIAN_BACKUP_REMINDER, "Pensez à sauvegader les SaveVariables de Librarian régulièrement. Cherchez 'Librarian' sur ESOUI pour plus d'explications (en anglais).", 1) @@ -27,11 +30,11 @@ SafeAddString(LIBRARIAN_SETTINGS_RELOADUI_REMINDER, "Rappel 'ReloadUI' aprè SafeAddString(LIBRARIAN_SETTINGS_RELOADUI_REMINDER_TOOLTIP, "Rappel pour lancer la commande /reloadui après que ce nombre de livre ait été découvert.", 1) SafeAddString(LIBRARIAN_SETTINGS_SHOW_HIDDEN_BOOK, "Montrer les livres cachés", 1) SafeAddString(LIBRARIAN_SETTINGS_SHOW_HIDDEN_BOOK_TOOLTIP, "TESO cache certaines collections de livres dans la bibliothèque. Par example les livres contenant le motif complet (au lieu des 14 pages) font parti de ces livres cachés. Donc, si vous souhaitez que le nombre de livre affiché dans Librarian corresponde à celui de la Bibliothèque, vous devez décocher cette case.", 1) -SafeAddString(LIBRARIAN_SETTINGS_UNREAD_INDICATOR_READER, "Icone 'Non-lu' (Liseuse)", 1) +SafeAddString(LIBRARIAN_SETTINGS_UNREAD_INDICATOR_READER, "Icône 'Non-lu' (Liseuse)", 1) SafeAddString(LIBRARIAN_SETTINGS_UNREAD_INDICATOR_READER_TOOLTIP, "Affiche une icone 'Non-lu' à côté du titre lors de la lecture d'un livre.", 1) SafeAddString(LIBRARIAN_SETTINGS_ICON_TRANSPARENCY, "Transparence de l'icone", 1) SafeAddString(LIBRARIAN_SETTINGS_ICON_TRANSPARENCY_TOOLTIP, "A quel point souhaitez-vous que l'icone 'Non-lu' soit transparente (100 complètement visible, 0 complètement transparente).", 1) -SafeAddString(LIBRARIAN_SETTINGS_UNREAD_INDICATOR_LIBRARY, "Icone 'Non-lu' (Bibliothèque)", 1) +SafeAddString(LIBRARIAN_SETTINGS_UNREAD_INDICATOR_LIBRARY, "Icône 'Non-lu' (Bibliothèque)", 1) SafeAddString(LIBRARIAN_SETTINGS_UNREAD_INDICATOR_LIBRARY_TOOLTIP, "Affiche une icone 'Non-lu' dans la Bibliothèque à côté des collections contenant au moins un livre 'Non-lu' et à côté de chaque livre 'Non-lu'.", 1) SafeAddString(LIBRARIAN_SETTINGS_CHARACTER_SPIN, "Tourner le personnage", 1) SafeAddString(LIBRARIAN_SETTINGS_CHARACTER_SPIN_TOOLTIP, "Tourne le personnage pour qu'il soit face à la camera quand Librarian est ouvert.", 1)