diff --git a/Changelog b/Changelog
index 0f3c70c..5a94b9d 100644
--- a/Changelog
+++ b/Changelog
@@ -1,6 +1,11 @@
-------------------------------------------------------------------------------
-Librarian v1.8 6/10/17
+Librarian v1.9 9/10/17
-------------------------------------------------------------------------------
+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)
diff --git a/Librarian.lua b/Librarian.lua
index 97b1ac7..87b34db 100644
--- a/Librarian.lua
+++ b/Librarian.lua
@@ -513,9 +513,9 @@ end
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)
+ LoreReader:SetupBook(book.title, book.body and table.concat(book.body), book.medium, book.showTitle)
SCENE_MANAGER:Push("loreReaderInteraction")
- PlaySound(LORE_READER.OpenSound)
+ -- PlaySound(LORE_READER.OpenSound)
end
function Librarian:FormatClockTime(time)
diff --git a/Librarian.txt b/Librarian.txt
index 3ec8e3a..a18873e 100644
--- a/Librarian.txt
+++ b/Librarian.txt
@@ -1,6 +1,6 @@
## Title: Librarian
## Author: |c4EFFF6Calia1120|r, Flamage
-## APIVersion: 100019
+## APIVersion: 100020
## SavedVariables: Librarian_SavedVariables
## OptionalDependsOn: LibAddonMenu-2.0
diff --git a/Libs/LibAddonMenu-2.0/LibAddonMenu-2.0.lua b/Libs/LibAddonMenu-2.0/LibAddonMenu-2.0.lua
index cb97a2e..b1070ca 100644
--- a/Libs/LibAddonMenu-2.0/LibAddonMenu-2.0.lua
+++ b/Libs/LibAddonMenu-2.0/LibAddonMenu-2.0.lua
@@ -4,7 +4,7 @@
--Register LAM with LibStub
-local MAJOR, MINOR = "LibAddonMenu-2.0", 23
+local MAJOR, MINOR = "LibAddonMenu-2.0", 24
local lam, oldminor = LibStub:NewLibrary(MAJOR, MINOR)
if not lam then return end --the same or newer version of this lib is already loaded into memory
@@ -340,6 +340,16 @@ local localization = {
RELOAD_DIALOG_RELOAD_BUTTON = "Reload",
RELOAD_DIALOG_DISCARD_BUTTON = "Discard",
},
+ it = { -- provided by JohnnyKing
+ PANEL_NAME = "Addon",
+ VERSION = "Versione: <<X:1>>",
+ WEBSITE = "Visita il Sitoweb",
+ RELOAD_UI_WARNING = "Cambiare questa impostazione richiede un Ricarica UI al fine che faccia effetto.",
+ RELOAD_DIALOG_TITLE = "Ricarica UI richiesto",
+ RELOAD_DIALOG_TEXT = "Alcune modifiche richiedono un Ricarica UI al fine che facciano effetto. Sei sicuro di voler ricaricare ora o di voler annullare le modifiche?",
+ RELOAD_DIALOG_RELOAD_BUTTON = "Ricarica",
+ RELOAD_DIALOG_DISCARD_BUTTON = "Annulla",
+ },
fr = { -- provided by Ayantir
PANEL_NAME = "Extensions",
WEBSITE = "Visiter le site Web",
@@ -363,9 +373,21 @@ local localization = {
VERSION = "Версия: <<X:1>>",
WEBSITE = "Посетить сайт",
PANEL_INFO_FONT = "RuESO/fonts/Univers57.otf|14|soft-shadow-thin",
+ RELOAD_UI_WARNING = "Для применения этой настройки необходима перезагрузка интерфейса.",
+ RELOAD_DIALOG_TITLE = "Необходима перезагрузка интерфейса",
+ RELOAD_DIALOG_TEXT = "Для применения некоторых изменений необходима перезагрузка интерфейса. Перезагрузить интерфейс сейчас или отменить изменения?",
+ RELOAD_DIALOG_RELOAD_BUTTON = "Перезагрузить",
+ RELOAD_DIALOG_DISCARD_BUTTON = "Отменить изменения",
},
- es = { -- provided by silvereyes333
- WEBSITE = "Vaya al sitio web",
+ es = { -- provided by Morganlefai, checked by Kwisatz
+ PANEL_NAME = "Configuración",
+ VERSION = "Versión: <<X:1>>",
+ WEBSITE = "Visita la página web",
+ RELOAD_UI_WARNING = "Cambiar este ajuste recargará la interfaz del usuario.",
+ RELOAD_DIALOG_TITLE = "Requiere recargar la interfaz",
+ RELOAD_DIALOG_TEXT = "Algunos cambios requieren recargar la interfaz para poder aplicarse. Quieres aplicar los cambios y recargar la interfaz?",
+ RELOAD_DIALOG_RELOAD_BUTTON = "Recargar",
+ RELOAD_DIALOG_DISCARD_BUTTON = "Cancelar",
},
jp = { -- provided by k0ta0uchi
PANEL_NAME = "アドオン設定",
@@ -377,6 +399,16 @@ local localization = {
WEBSITE = "访问网站",
PANEL_INFO_FONT = "EsoZh/fonts/univers57.otf|14|soft-shadow-thin",
},
+ pl = { -- provided by EmiruTegryfon
+ PANEL_NAME = "Dodatki",
+ VERSION = "Wersja: <<X:1>>",
+ WEBSITE = "Odwiedź stronę",
+ RELOAD_UI_WARNING = "Zmiany będą widoczne po ponownym załadowaniu UI.",
+ RELOAD_DIALOG_TITLE = "Wymagane przeładowanie UI",
+ RELOAD_DIALOG_TEXT = "Niektóre zmiany wymagają ponownego załadowania UI. Czy chcesz teraz ponownie załadować, czy porzucić zmiany?",
+ RELOAD_DIALOG_RELOAD_BUTTON = "Przeładuj",
+ RELOAD_DIALOG_DISCARD_BUTTON = "Porzuć",
+ },
}
util.L = ZO_ShallowTableCopy(localization[GetCVar("Language.2")], localization["en"])
@@ -713,12 +745,12 @@ local function CreateOptionsControls(panel)
err, anchorOffset, lastAddedControl, wasHalf = CreateAndAnchorWidget(parent, widgetData, offsetX, anchorOffset, lastAddedControl, wasHalf)
if err then
- PrintLater(("Could not create %s '%s' of %s."):format(widgetData.type, widgetData.name or "unnamed", addonID))
+ PrintLater(("Could not create %s '%s' of %s."):format(widgetData.type, GetStringFromValue(widgetData.name or "unnamed"), addonID))
end
if isSubmenu then
if SetupCreationCalls(lastAddedControl, widgetData.controls) then
- PrintLater(("The sub menu '%s' of %s is missing some entries."):format(widgetData.name or "unnamed", addonID))
+ PrintLater(("The sub menu '%s' of %s is missing some entries."):format(GetStringFromValue(widgetData.name or "unnamed"), addonID))
end
end
end
diff --git a/Libs/LibAddonMenu-2.0/LibAddonMenu-2.0.txt b/Libs/LibAddonMenu-2.0/LibAddonMenu-2.0.txt
new file mode 100644
index 0000000..8226bf1
--- /dev/null
+++ b/Libs/LibAddonMenu-2.0/LibAddonMenu-2.0.txt
@@ -0,0 +1,31 @@
+## APIVersion: 100019
+## Title: LibAddonMenu-2.0
+## Version: 2.0 r24
+## Author: Seerah, sirinsidiator, et al.
+## Contributors: votan, merlight, Garkin, Randactyl, KuroiLight, silvereyes333, Baertram, kyoma
+## Description: A library to aid in the creation of option panels.
+##
+## This Add-on is not created by, affiliated with or sponsored by ZeniMax Media Inc. or its affiliates.
+## The Elder Scrolls® and related logos are registered trademarks or trademarks of ZeniMax Media Inc. in the United States and/or other countries.
+## All rights reserved
+##
+## You can read the full terms at https://account.elderscrollsonline.com/add-on-terms
+
+LibStub\LibStub.lua
+
+LibAddonMenu-2.0\LibAddonMenu-2.0.lua
+
+LibAddonMenu-2.0\controls\panel.lua
+LibAddonMenu-2.0\controls\submenu.lua
+LibAddonMenu-2.0\controls\button.lua
+LibAddonMenu-2.0\controls\checkbox.lua
+LibAddonMenu-2.0\controls\colorpicker.lua
+LibAddonMenu-2.0\controls\custom.lua
+LibAddonMenu-2.0\controls\description.lua
+LibAddonMenu-2.0\controls\dropdown.lua
+LibAddonMenu-2.0\controls\editbox.lua
+LibAddonMenu-2.0\controls\header.lua
+LibAddonMenu-2.0\controls\slider.lua
+LibAddonMenu-2.0\controls\texture.lua
+LibAddonMenu-2.0\controls\iconpicker.lua
+LibAddonMenu-2.0\controls\divider.lua
diff --git a/Libs/LibAddonMenu-2.0/controls/dropdown.lua b/Libs/LibAddonMenu-2.0/controls/dropdown.lua
index 2349ba6..f8ea731 100644
--- a/Libs/LibAddonMenu-2.0/controls/dropdown.lua
+++ b/Libs/LibAddonMenu-2.0/controls/dropdown.lua
@@ -9,6 +9,7 @@
choicesTooltips = {"tooltip 1", "tooltip 2", "tooltip 3"}, -- or array of string ids or array of functions returning a string (optional)
sort = "name-up", --or "name-down", "numeric-up", "numeric-down", "value-up", "value-down", "numericvalue-up", "numericvalue-down" (optional) - if not provided, list will not be sorted
width = "full", --or "half" (optional)
+ scrollable = true, -- boolean or number, if set the dropdown will feature a scroll bar if there are a large amount of choices and limit the visible lines to the specified number or 10 if true is used (optional)
disabled = function() return db.someBooleanSetting end, --or boolean (optional)
warning = "May cause permanent awesomeness.", -- or string id or function returning a string (optional)
requiresReload = false, -- boolean, if set to true, the warning text will contain a notice that changes are only applied after an UI reload and any change to the value will make the "Apply Settings" button appear on the panel which will reload the UI when pressed (optional)
@@ -17,7 +18,7 @@
} ]]
-local widgetVersion = 16
+local widgetVersion = 17
local LAM = LibStub("LibAddonMenu-2.0")
if not LAM:RegisterWidget("dropdown", widgetVersion) then return end
@@ -149,6 +150,138 @@ local function GrabSortingInfo(sortInfo)
return t
end
+local DEFAULT_VISIBLE_ROWS = 10
+local SCROLLABLE_ENTRY_TEMPLATE_HEIGHT = 25 -- same as in zo_combobox.lua
+local CONTENT_PADDING = 24
+local SCROLLBAR_PADDING = 16
+local PADDING = GetMenuPadding() / 2 -- half the amount looks closer to the regular dropdown
+local ScrollableDropdownHelper = ZO_Object:Subclass()
+
+function ScrollableDropdownHelper:New(...)
+ local object = ZO_Object.New(self)
+ object:Initialize(...)
+ return object
+end
+
+function ScrollableDropdownHelper:Initialize(parent, control, visibleRows)
+ local combobox = control.combobox
+ local dropdown = control.dropdown
+ self.parent = parent
+ self.control = control
+ self.combobox = combobox
+ self.dropdown = dropdown
+ self.visibleRows = visibleRows
+
+ -- clear anchors so we can adjust the width dynamically
+ dropdown.m_dropdown:ClearAnchors()
+ dropdown.m_dropdown:SetAnchor(TOPLEFT, combobox, BOTTOMLEFT)
+
+ -- handle dropdown or settingsmenu opening/closing
+ local function onShow() self:OnShow() end
+ local function onHide() self:OnHide() end
+ local function doHide() self:DoHide() end
+
+ ZO_PreHook(dropdown, "ShowDropdownOnMouseUp", onShow)
+ ZO_PreHook(dropdown, "HideDropdownInternal", onHide)
+ combobox:SetHandler("OnEffectivelyHidden", onHide)
+ parent:SetHandler("OnEffectivelyHidden", doHide)
+
+ -- dont fade entries near the edges
+ local scrollList = dropdown.m_scroll
+ scrollList.selectionTemplate = nil
+ scrollList.highlightTemplate = nil
+ ZO_ScrollList_EnableSelection(scrollList, "ZO_SelectionHighlight")
+ ZO_ScrollList_EnableHighlight(scrollList, "ZO_SelectionHighlight")
+ ZO_Scroll_SetUseFadeGradient(scrollList, false)
+
+ -- adjust scroll content anchor to mimic menu padding
+ local scroll = dropdown.m_dropdown:GetNamedChild("Scroll")
+ local anchor1 = {scroll:GetAnchor(0)}
+ local anchor2 = {scroll:GetAnchor(1)}
+ scroll:ClearAnchors()
+ scroll:SetAnchor(anchor1[2], anchor1[3], anchor1[4], anchor1[5] + PADDING, anchor1[6] + PADDING)
+ scroll:SetAnchor(anchor2[2], anchor2[3], anchor2[4], anchor2[5] - PADDING, anchor2[6] - PADDING)
+ ZO_ScrollList_Commit(scrollList)
+
+ -- adjust row setup to mimic the highlight padding
+ local dataType1 = ZO_ScrollList_GetDataTypeTable(dropdown.m_scroll, 1)
+ local dataType2 = ZO_ScrollList_GetDataTypeTable(dropdown.m_scroll, 2)
+ local oSetup = dataType1.setupCallback -- both types have the same setup function
+ local function SetupEntry(control, data, list)
+ oSetup(control, data, list)
+ control.m_label:SetAnchor(LEFT, nil, nil, 2)
+ end
+ dataType1.setupCallback = SetupEntry
+ dataType2.setupCallback = SetupEntry
+
+ -- adjust dimensions based on entries
+ local scrollContent = scroll:GetNamedChild("Contents")
+ ZO_PreHook(dropdown, "AddMenuItems", function()
+ local width = PADDING * 2 + zo_max(self:GetMaxWidth(), combobox:GetWidth())
+ local numItems = #dropdown.m_sortedItems
+ local anchorOffset = 0
+ if(numItems > self.visibleRows) then
+ width = width + CONTENT_PADDING + SCROLLBAR_PADDING
+ anchorOffset = -SCROLLBAR_PADDING
+ numItems = self.visibleRows
+ end
+ scrollContent:SetAnchor(BOTTOMRIGHT, nil, nil, anchorOffset)
+ local height = PADDING * 2 + numItems * (SCROLLABLE_ENTRY_TEMPLATE_HEIGHT + dropdown.m_spacing) - dropdown.m_spacing
+ dropdown.m_dropdown:SetWidth(width)
+ dropdown.m_dropdown:SetHeight(height)
+ end)
+end
+
+function ScrollableDropdownHelper:OnShow()
+ local dropdown = self.dropdown
+ if dropdown.m_lastParent ~= ZO_Menus then
+ dropdown.m_lastParent = dropdown.m_dropdown:GetParent()
+ dropdown.m_dropdown:SetParent(ZO_Menus)
+ ZO_Menus:BringWindowToTop()
+ end
+end
+
+function ScrollableDropdownHelper:OnHide()
+ local dropdown = self.dropdown
+ if dropdown.m_lastParent then
+ dropdown.m_dropdown:SetParent(dropdown.m_lastParent)
+ dropdown.m_lastParent = nil
+ end
+end
+
+function ScrollableDropdownHelper:DoHide()
+ local dropdown = self.dropdown
+ if dropdown:IsDropdownVisible() then
+ dropdown:HideDropdown()
+ end
+end
+
+function ScrollableDropdownHelper:GetMaxWidth()
+ local dropdown = self.dropdown
+ local dataType = ZO_ScrollList_GetDataTypeTable(dropdown.m_scroll, 1)
+
+ local dummy = dataType.pool:AcquireObject()
+ dataType.setupCallback(dummy, {
+ m_owner = dropdown,
+ name = "Dummy"
+ }, dropdown)
+
+ local maxWidth = 0
+ local label = dummy.m_label
+ local entries = dropdown.m_sortedItems
+ local numItems = #entries
+ for index = 1, numItems do
+ label:SetText(entries[index].name)
+ local width = label:GetTextWidth()
+ if (width > maxWidth) then
+ maxWidth = width
+ end
+ end
+
+ dataType.pool:ReleaseObject(dummy.key)
+ return maxWidth
+end
+
function LAMCreateControl.dropdown(parent, dropdownData, controlName)
local control = LAM.util.CreateLabelAndContainerControl(parent, dropdownData, controlName)
control.choices = {}
@@ -161,7 +294,7 @@ function LAMCreateControl.dropdown(parent, dropdownData, controlName)
end
local comboboxCount = (countControl.comboboxCount or 0) + 1
countControl.comboboxCount = comboboxCount
- control.combobox = wm:CreateControlFromVirtual(zo_strjoin(nil, name, "Combobox", comboboxCount), control.container, "ZO_ComboBox")
+ control.combobox = wm:CreateControlFromVirtual(zo_strjoin(nil, name, "Combobox", comboboxCount), control.container, dropdownData.scrollable and "ZO_ScrollableComboBox" or "ZO_ComboBox")
local combobox = control.combobox
combobox:SetAnchor(TOPLEFT)
@@ -172,6 +305,11 @@ function LAMCreateControl.dropdown(parent, dropdownData, controlName)
local dropdown = control.dropdown
dropdown:SetSortsItems(false) -- need to sort ourselves in order to be able to sort by value
+ if dropdownData.scrollable then
+ local visibleRows = type(dropdownData.scrollable) == "number" and dropdownData.scrollable or DEFAULT_VISIBLE_ROWS
+ control.scrollHelper = ScrollableDropdownHelper:New(parent, control, visibleRows)
+ end
+
ZO_PreHook(dropdown, "UpdateItems", function(self)
assert(not self.m_sortsItems, "built-in dropdown sorting was reactivated, sorting is handled by LAM")
if control.m_sortOrder ~= nil and control.m_sortType then