diff --git a/Inventory.lua b/Inventory.lua index ce8434c..57e1255 100644 --- a/Inventory.lua +++ b/Inventory.lua @@ -4,7 +4,7 @@ local m = SousChef.Media local LibSort = LibStub:GetLibrary("LibSort-1.0") function SousChef.AddRankToSlot(row, funcs) - local idFunc = funcs[1] + local idFunc = funcs[1] local slot = row.dataEntry.data local bagId = slot[funcs[2]] local slotIndex = funcs[3] and slot[funcs[3]] or nil @@ -77,9 +77,9 @@ function SousChef.SetupSort() LibSort:RegisterDefaultOrder("Sous Chef", {"Ingredient Rank"}) end -function SousChef.FindIngredientRank(slotType, bagId, slotIndex) +function SousChef.FindIngredientRank(bagId, slotIndex) local id = u.GetItemID(GetItemLink(bagId, slotIndex)) local texture = SousChef.Pantry[id] if SousChef.settings.showAltIngredientKnowledge then texture = SousChef.settings.Pantry[id] end return texture or 100 -end \ No newline at end of file +end diff --git a/libs/LibAddonMenu-2.0/LibAddonMenu-2.0.lua b/libs/LibAddonMenu-2.0/LibAddonMenu-2.0.lua index 6ec9c4e..2ff2024 100644 --- a/libs/LibAddonMenu-2.0/LibAddonMenu-2.0.lua +++ b/libs/LibAddonMenu-2.0/LibAddonMenu-2.0.lua @@ -7,7 +7,7 @@ --Register LAM with LibStub -local MAJOR, MINOR = "LibAddonMenu-2.0", 7 +local MAJOR, MINOR = "LibAddonMenu-2.0", 14 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 @@ -22,7 +22,8 @@ local _ local addonsForList = {} local addonToOptionsMap = {} local optionsCreated = {} -local widgets = {} +lam.widgets = lam.widgets or {} +local widgets = lam.widgets --METHOD: REGISTER WIDGET-- @@ -57,6 +58,10 @@ function lam:OpenToPanel(panel) ZO_GameMenu_InGame.gameMenu.headerControls[locSettings]:SetOpen(true) SCENE_MANAGER:AddFragment(OPTIONS_WINDOW_FRAGMENT) ZO_OptionsWindow_ChangePanels(lam.panelID) + if not lam.panelSubCategoryControl then + lam.panelSubCategoryControl = _G["ZO_GameMenu_InGameNavigationContainerScrollChildZO_GameMenu_SubCategory"..(lam.panelID + 1)] + end + ZO_TreeEntry_OnMouseUp(lam.panelSubCategoryControl, true) panel:SetHidden(false) end, 200) end @@ -218,9 +223,11 @@ end local function CreateAddonSettingsPanel() if not LAMSettingsPanelCreated then local controlPanelID = "LAM_ADDON_SETTINGS_PANEL" - local controlPanelNames = {en = "Addon Settings", fr = "Extensions", de = "Erweiterungen"} + --Russian for TERAB1T's RuESO addon, which creates an "ru" locale + --game font does not support Cyrillic, so they are using custom fonts + extended latin charset + local controlPanelNames = {en = "Addon Settings", fr = "Extensions", de = "Erweiterungen", ru = "Îacòpoéêè äoïoìîeîèé"} - ZO_OptionsWindow_AddUserPanel(controlPanelID, controlPanelNames[GetCVar("Language.2")]) + ZO_OptionsWindow_AddUserPanel(controlPanelID, controlPanelNames[GetCVar("Language.2")] or controlPanelName["en"]) lam.panelID = _G[controlPanelID] @@ -235,14 +242,14 @@ end --adds each registered addon to the menu in LAM's panel local function CreateAddonButtons(list, addons) for i = 1, #addons do - local button = wm:CreateControlFromVirtual("LAMAddonMenuButton"..i, list, "ZO_DefaultTextButton") + local button = wm:CreateControlFromVirtual("LAMAddonMenuButton"..i, list.scrollChild, "ZO_DefaultTextButton") button.name = addons[i].name button.panel = _G[addons[i].panel] button:SetText(button.name) button:SetHorizontalAlignment(TEXT_ALIGN_LEFT) button:SetWidth(190) if i == 1 then - button:SetAnchor(TOPLEFT, list, TOPLEFT, 5, 5) + button:SetAnchor(TOPLEFT, list.scrollChild, TOPLEFT, 5, 5) else button:SetAnchor(TOPLEFT, _G["LAMAddonMenuButton"..i-1], BOTTOMLEFT) end @@ -265,9 +272,12 @@ local function CreateAddonList() list.bg = list.bg or wm:CreateControl(nil, list, CT_BACKDROP) local bg = list.bg bg:SetAnchorFill() --offsets of 8? - bg:SetEdgeTexture("EsoUI\\Art\\Tooltips\\UI-Border.dds", 128, 16) + bg:SetEdgeTexture("EsoUI\\Art\\miscellaneous\\borderedinsettransparent_edgefile.dds", 128, 16) bg:SetCenterColor(0, 0, 0, 0) + list.scrollChild = LAMAddonPanelsMenuScrollChild + list.scrollChild:SetResizeToFitPadding(0, 15) + local generatedButtons list:SetHandler("OnShow", function(self) if not generatedButtons and #addonsForList > 0 then diff --git a/libs/LibAddonMenu-2.0/controls/button.lua b/libs/LibAddonMenu-2.0/controls/button.lua index 8033833..205b25c 100644 --- a/libs/LibAddonMenu-2.0/controls/button.lua +++ b/libs/LibAddonMenu-2.0/controls/button.lua @@ -11,7 +11,7 @@ } ]] -local widgetVersion = 2 +local widgetVersion = 3 local LAM = LibStub("LibAddonMenu-2.0") if not LAM:RegisterWidget("button", widgetVersion) then return end @@ -34,7 +34,7 @@ end --controlName is optional function LAMCreateControl.button(parent, buttonData, controlName) local control = wm:CreateTopLevelWindow(controlName or buttonData.reference) - control:SetParent(parent.scroll) + control:SetParent(parent.scroll or parent) local isHalfWidth = buttonData.width == "half" control:SetDimensions(isHalfWidth and 250 or 510, isHalfWidth and 55 or 28) diff --git a/libs/LibAddonMenu-2.0/controls/checkbox.lua b/libs/LibAddonMenu-2.0/controls/checkbox.lua index 43ab28c..52bfc87 100644 --- a/libs/LibAddonMenu-2.0/controls/checkbox.lua +++ b/libs/LibAddonMenu-2.0/controls/checkbox.lua @@ -12,7 +12,7 @@ } ]] -local widgetVersion = 4 +local widgetVersion = 5 local LAM = LibStub("LibAddonMenu-2.0") if not LAM:RegisterWidget("checkbox", widgetVersion) then return end @@ -105,7 +105,7 @@ end --controlName is optional function LAMCreateControl.checkbox(parent, checkboxData, controlName) local control = wm:CreateTopLevelWindow(controlName or checkboxData.reference) - control:SetParent(parent.scroll) + control:SetParent(parent.scroll or parent) control:SetMouseEnabled(true) control.tooltipText = checkboxData.tooltip control:SetHandler("OnMouseEnter", OnMouseEnter) diff --git a/libs/LibAddonMenu-2.0/controls/colorpicker.lua b/libs/LibAddonMenu-2.0/controls/colorpicker.lua index 5b58ca1..5cb314b 100644 --- a/libs/LibAddonMenu-2.0/controls/colorpicker.lua +++ b/libs/LibAddonMenu-2.0/controls/colorpicker.lua @@ -12,7 +12,7 @@ } ]] -local widgetVersion = 2 +local widgetVersion = 3 local LAM = LibStub("LibAddonMenu-2.0") if not LAM:RegisterWidget("colorpicker", widgetVersion) then return end @@ -59,7 +59,7 @@ end function LAMCreateControl.colorpicker(parent, colorpickerData, controlName) local control = wm:CreateTopLevelWindow(controlName or colorpickerData.reference) - control:SetParent(parent.scroll) + control:SetParent(parent.scroll or parent) control:SetMouseEnabled(true) control.tooltipText = colorpickerData.tooltip control:SetHandler("OnMouseEnter", ZO_Options_OnMouseEnter) diff --git a/libs/LibAddonMenu-2.0/controls/custom.lua b/libs/LibAddonMenu-2.0/controls/custom.lua index 1dd48ba..fcfa618 100644 --- a/libs/LibAddonMenu-2.0/controls/custom.lua +++ b/libs/LibAddonMenu-2.0/controls/custom.lua @@ -1,19 +1,27 @@ --[[customData = { type = "custom", - reference = "MyAddonCustomControl", --unique name for your control to use as reference + reference = "MyAddonCustomControl", --(optional) unique name for your control to use as reference + refreshFunc = function(customControl) end, --(optional) function to call when panel/controls refresh width = "full", --or "half" (optional) } ]] -local widgetVersion = 2 +local widgetVersion = 4 local LAM = LibStub("LibAddonMenu-2.0") if not LAM:RegisterWidget("custom", widgetVersion) then return end local wm = WINDOW_MANAGER +local tinsert = table.insert + +local function UpdateValue(control) + if control.data.refreshFunc then + control.data.refreshFunc(control) + end +end function LAMCreateControl.custom(parent, customData, controlName) local control = wm:CreateTopLevelWindow(controlName or customData.reference) control:SetResizeToFitDescendents(true) - control:SetParent(parent.scroll) + control:SetParent(parent.scroll or parent) local isHalfWidth = customData.width == "half" if isHalfWidth then --note these restrictions @@ -27,5 +35,11 @@ function LAMCreateControl.custom(parent, customData, controlName) control.panel = parent.panel or parent --if this is in a submenu, panel is its parent control.data = customData + control.UpdateValue = UpdateValue + + if control.panel.data.registerForRefresh or control.panel.data.registerForDefaults then --if our parent window wants to refresh controls, then add this to the list + tinsert(control.panel.controlsToRefresh, control) + end + return control end \ No newline at end of file diff --git a/libs/LibAddonMenu-2.0/controls/description.lua b/libs/LibAddonMenu-2.0/controls/description.lua index bd6fe1d..aac6d9e 100644 --- a/libs/LibAddonMenu-2.0/controls/description.lua +++ b/libs/LibAddonMenu-2.0/controls/description.lua @@ -7,16 +7,24 @@ } ]] -local widgetVersion = 2 +local widgetVersion = 4 local LAM = LibStub("LibAddonMenu-2.0") if not LAM:RegisterWidget("description", widgetVersion) then return end local wm = WINDOW_MANAGER +local tinsert = table.insert + +local function UpdateValue(control) + if control.title then + control.title:SetText(control.data.title) + end + control.desc:SetText(control.data.text) +end function LAMCreateControl.description(parent, descriptionData, controlName) local control = wm:CreateTopLevelWindow(controlName or descriptionData.reference) control:SetResizeToFitDescendents(true) - control:SetParent(parent.scroll) + control:SetParent(parent.scroll or parent) local isHalfWidth = descriptionData.width == "half" if isHalfWidth then control:SetDimensionConstraints(250, 55, 250, 100) @@ -47,6 +55,12 @@ function LAMCreateControl.description(parent, descriptionData, controlName) control.panel = parent.panel or parent --if this is in a submenu, panel is its parent control.data = descriptionData + + control.UpdateValue = UpdateValue + + if control.panel.data.registerForRefresh or control.panel.data.registerForDefaults then --if our parent window wants to refresh controls, then add this to the list + tinsert(control.panel.controlsToRefresh, control) + end return control diff --git a/libs/LibAddonMenu-2.0/controls/dropdown.lua b/libs/LibAddonMenu-2.0/controls/dropdown.lua index 36610b8..fd5320a 100644 --- a/libs/LibAddonMenu-2.0/controls/dropdown.lua +++ b/libs/LibAddonMenu-2.0/controls/dropdown.lua @@ -14,7 +14,7 @@ } ]] -local widgetVersion = 3 +local widgetVersion = 5 local LAM = LibStub("LibAddonMenu-2.0") if not LAM:RegisterWidget("dropdown", widgetVersion) then return end @@ -86,7 +86,7 @@ end local comboboxCount = 1 function LAMCreateControl.dropdown(parent, dropdownData, controlName) local control = wm:CreateTopLevelWindow(controlName or dropdownData.reference) - control:SetParent(parent.scroll) + control:SetParent(parent.scroll or parent) control:SetMouseEnabled(true) control.tooltipText = dropdownData.tooltip control:SetHandler("OnMouseEnter", ZO_Options_OnMouseEnter) @@ -116,21 +116,19 @@ function LAMCreateControl.dropdown(parent, dropdownData, controlName) if isHalfWidth then control:SetDimensions(250, 55) label:SetDimensions(250, 26) - combobox:SetDimensions(240, 26) - --dropdown:SetWidth(240) + combobox:SetDimensions(225, 26) combobox:SetAnchor(TOPRIGHT, label, BOTTOMRIGHT) else control:SetDimensions(510, 30) label:SetDimensions(300, 26) combobox:SetDimensions(200, 26) - --dropdown:SetWidth(200) combobox:SetAnchor(TOPRIGHT) end - if warning then + if dropdownData.warning then control.warning = wm:CreateControlFromVirtual(nil, control, "ZO_Options_WarningIcon") control.warning:SetAnchor(RIGHT, combobox, LEFT, -5, 0) - control.warning.tooltipText = warningText + control.warning.tooltipText = dropdownData.warning end control.panel = parent.panel or parent --if this is in a submenu, panel is its parent diff --git a/libs/LibAddonMenu-2.0/controls/editbox.lua b/libs/LibAddonMenu-2.0/controls/editbox.lua index 0b97ae1..b20163d 100644 --- a/libs/LibAddonMenu-2.0/controls/editbox.lua +++ b/libs/LibAddonMenu-2.0/controls/editbox.lua @@ -13,7 +13,7 @@ } ]] -local widgetVersion = 3 +local widgetVersion = 4 local LAM = LibStub("LibAddonMenu-2.0") if not LAM:RegisterWidget("editbox", widgetVersion) then return end @@ -61,7 +61,7 @@ end function LAMCreateControl.editbox(parent, editboxData, controlName) local control = wm:CreateTopLevelWindow(controlName or editboxData.reference) - control:SetParent(parent.scroll) + control:SetParent(parent.scroll or parent) control:SetMouseEnabled(true) control:SetResizeToFitDescendents(true) control.tooltipText = editboxData.tooltip diff --git a/libs/LibAddonMenu-2.0/controls/header.lua b/libs/LibAddonMenu-2.0/controls/header.lua index ce6f463..98df539 100644 --- a/libs/LibAddonMenu-2.0/controls/header.lua +++ b/libs/LibAddonMenu-2.0/controls/header.lua @@ -6,15 +6,20 @@ } ]] -local widgetVersion = 2 +local widgetVersion = 4 local LAM = LibStub("LibAddonMenu-2.0") if not LAM:RegisterWidget("header", widgetVersion) then return end local wm = WINDOW_MANAGER +local tinsert = table.insert + +local function UpdateValue(control) + control.header:SetText(control.data.name) +end function LAMCreateControl.header(parent, headerData, controlName) local control = wm:CreateTopLevelWindow(controlName or headerData.reference) - control:SetParent(parent.scroll) + control:SetParent(parent.scroll or parent) local isHalfWidth = headerData.width == "half" control:SetDimensions(isHalfWidth and 250 or 510, 30) @@ -32,5 +37,11 @@ function LAMCreateControl.header(parent, headerData, controlName) control.panel = parent.panel or parent --if this is in a submenu, panel is its parent control.data = headerData + control.UpdateValue = UpdateValue + + if control.panel.data.registerForRefresh or control.panel.data.registerForDefaults then --if our parent window wants to refresh controls, then add this to the list + tinsert(control.panel.controlsToRefresh, control) + end + return control end \ No newline at end of file diff --git a/libs/LibAddonMenu-2.0/controls/panel.lua b/libs/LibAddonMenu-2.0/controls/panel.lua index 7de8da4..158fd8d 100644 --- a/libs/LibAddonMenu-2.0/controls/panel.lua +++ b/libs/LibAddonMenu-2.0/controls/panel.lua @@ -11,7 +11,7 @@ } ]] -local widgetVersion = 4 +local widgetVersion = 8 local LAM = LibStub("LibAddonMenu-2.0") if not LAM:RegisterWidget("panel", widgetVersion) then return end @@ -70,7 +70,8 @@ ESO_Dialogs["LAM_DEFAULTS"] = { }, } -local scrollCount = 1 +local callbackRegistered = false +LAMCreateControl.scrollCount = LAMCreateControl.scrollCount or 1 function LAMCreateControl.panel(parent, panelData, controlName) local control = wm:CreateTopLevelWindow(controlName) control:SetParent(parent) @@ -78,7 +79,7 @@ function LAMCreateControl.panel(parent, panelData, controlName) control.bg = wm:CreateControl(nil, control, CT_BACKDROP) local bg = control.bg bg:SetAnchorFill() - bg:SetEdgeTexture("EsoUI\\Art\\Tooltips\\UI-Border.dds", 128, 16) + bg:SetEdgeTexture("EsoUI\\Art\\miscellaneous\\borderedinsettransparent_edgefile.dds", 128, 16) bg:SetCenterColor(0, 0, 0, 0) control.label = wm:CreateControlFromVirtual(nil, control, "ZO_Options_SectionTitleLabel") @@ -103,8 +104,8 @@ function LAMCreateControl.panel(parent, panelData, controlName) end end - control.container = wm:CreateControlFromVirtual("LAMAddonPanelContainer"..scrollCount, control, "ZO_ScrollContainer") - scrollCount = scrollCount + 1 + control.container = wm:CreateControlFromVirtual("LAMAddonPanelContainer"..LAMCreateControl.scrollCount, control, "ZO_ScrollContainer") + LAMCreateControl.scrollCount = LAMCreateControl.scrollCount + 1 local container = control.container container:SetAnchor(TOPLEFT, label, BOTTOMLEFT, 0, 20) container:SetAnchor(BOTTOMRIGHT, control, BOTTOMRIGHT, -3, -3) @@ -125,8 +126,9 @@ function LAMCreateControl.panel(parent, panelData, controlName) end) end - if panelData.registerForRefresh then + if panelData.registerForRefresh and not callbackRegistered then --don't want to register our callback more than once cm:RegisterCallback("LAM-RefreshPanel", RefreshPanel) + callbackRegistered = true end control.data = panelData diff --git a/libs/LibAddonMenu-2.0/controls/slider.lua b/libs/LibAddonMenu-2.0/controls/slider.lua index e58c623..7f1e866 100644 --- a/libs/LibAddonMenu-2.0/controls/slider.lua +++ b/libs/LibAddonMenu-2.0/controls/slider.lua @@ -15,7 +15,7 @@ } ]] -local widgetVersion = 2 +local widgetVersion = 3 local LAM = LibStub("LibAddonMenu-2.0") if not LAM:RegisterWidget("slider", widgetVersion) then return end @@ -69,7 +69,7 @@ end function LAMCreateControl.slider(parent, sliderData, controlName) local control = wm:CreateTopLevelWindow(controlName or sliderData.reference) - control:SetParent(parent.scroll) + control:SetParent(parent.scroll or parent) local isHalfWidth = sliderData.width == "half" if isHalfWidth then control:SetDimensions(250, 55) @@ -164,7 +164,7 @@ function LAMCreateControl.slider(parent, sliderData, controlName) control.warning.tooltipText = sliderData.warning end - control.panel = parent.panel or parent --if this is in a submenu, panel is its parent + control.panel = parent.panel or parent --if this is in a submenu, panel is the submenu's parent control.data = sliderData if sliderData.disabled then diff --git a/libs/LibAddonMenu-2.0/controls/submenu.lua b/libs/LibAddonMenu-2.0/controls/submenu.lua index fc5a325..c184256 100644 --- a/libs/LibAddonMenu-2.0/controls/submenu.lua +++ b/libs/LibAddonMenu-2.0/controls/submenu.lua @@ -6,16 +6,24 @@ reference = "MyAddonSubmenu" --(optional) unique global reference to control } ]] -local widgetVersion = 2 +local widgetVersion = 5 local LAM = LibStub("LibAddonMenu-2.0") if not LAM:RegisterWidget("submenu", widgetVersion) then return end local wm = WINDOW_MANAGER local am = ANIMATION_MANAGER +local tinsert = table.insert -local function AnimateSubmenu(label) - local control = label:GetParent() +local function UpdateValue(control) + control.label:SetText(control.data.name) + if control.data.tooltip then + control.label.tooltipText = control.data.tooltip + end +end + +local function AnimateSubmenu(clicked) + local control = clicked:GetParent() control.open = not control.open if control.open then @@ -28,7 +36,7 @@ end function LAMCreateControl.submenu(parent, submenuData, controlName) local control = wm:CreateTopLevelWindow(controlName or submenuData.reference) - control:SetParent(parent.scroll) + control:SetParent(parent.scroll or parent) control.panel = parent control:SetDimensions(523, 40) @@ -49,7 +57,7 @@ function LAMCreateControl.submenu(parent, submenuData, controlName) local scroll = control.scroll scroll:SetParent(control) scroll:SetAnchor(TOPLEFT, label, BOTTOMLEFT, 0, 10) - scroll:SetDimensionConstraints(525, 0, 525, 1500) + scroll:SetDimensionConstraints(525, 0, 525, 2500) control.bg = wm:CreateControl(nil, label, CT_BACKDROP) local bg = control.bg @@ -90,8 +98,24 @@ function LAMCreateControl.submenu(parent, submenuData, controlName) end end) + --small strip at the bottom of the submenu that you can click to close it + control.btmToggle = wm:CreateControl(nil, control, CT_TEXTURE) + local btmToggle = control.btmToggle + btmToggle:SetMouseEnabled(true) + btmToggle:SetAnchor(BOTTOMLEFT, control.scroll, BOTTOMLEFT) + btmToggle:SetAnchor(BOTTOMRIGHT, control.scroll, BOTTOMRIGHT) + btmToggle:SetHeight(15) + btmToggle:SetAlpha(0) + btmToggle:SetHandler("OnMouseUp", AnimateSubmenu) + control.data = submenuData + control.UpdateValue = UpdateValue + + if control.panel.data.registerForRefresh or control.panel.data.registerForDefaults then --if our parent window wants to refresh controls, then add this to the list + tinsert(control.panel.controlsToRefresh, control) + end + return control end diff --git a/libs/LibAddonMenu-2.0/controls/texture.lua b/libs/LibAddonMenu-2.0/controls/texture.lua index 4729bbc..7035bcc 100644 --- a/libs/LibAddonMenu-2.0/controls/texture.lua +++ b/libs/LibAddonMenu-2.0/controls/texture.lua @@ -10,7 +10,7 @@ --add texture coords support? -local widgetVersion = 2 +local widgetVersion = 3 local LAM = LibStub("LibAddonMenu-2.0") if not LAM:RegisterWidget("texture", widgetVersion) then return end @@ -19,7 +19,7 @@ local wm = WINDOW_MANAGER function LAMCreateControl.texture(parent, textureData, controlName) local control = wm:CreateTopLevelWindow(controlName or textureData.reference) control:SetResizeToFitDescendents(true) - control:SetParent(parent.scroll) + control:SetParent(parent.scroll or parent) local isHalfWidth = textureData.width == "half" if isHalfWidth then diff --git a/libs/LibSort-1.0/LibSort-1.0.lua b/libs/LibSort-1.0/LibSort-1.0.lua index 11dbc92..496c3c1 100644 --- a/libs/LibSort-1.0/LibSort-1.0.lua +++ b/libs/LibSort-1.0/LibSort-1.0.lua @@ -1,5 +1,8 @@ -local MAJOR, MINOR = "LibSort-1.0", 5 -local LibSort, oldminor = LibStub:NewLibrary(MAJOR, MINOR) +local LibSort, oldminor = LibStub:NewLibrary("LibSort-1.0", 6) +d("LIBSORT"); +d(LibSort); +d(oldminor); + if not LibSort then return end --the same or newer version of this lib is already loaded into memory if not LibSort.RegisteredCallbacks then LibSort.RegisteredCallbacks = {} end @@ -39,17 +42,17 @@ function LibSort:SetupArrows() LibSort.ItemSortBank:SetDimensions(16, 32) LibSort.ItemSortBank:SetAnchor(RIGHT, ZO_PlayerBankSortByName, LEFT, -15) ZO_SortHeader_SetTooltip(LibSort.ItemSortBank, "Sort", BOTTOMRIGHT, 0, 32) - ZO_SortHeader_InitializeArrowHeader(LibSort.ItemSortBank, "age", ZO_SORT_ORDER_DOWN) + ZO_SortHeader_InitializeArrowHeader(LibSort.ItemSortBank, "age", ZO_SORT_ORDER_DOWN) - PLAYER_INVENTORY.inventories[INVENTORY_BANK].sortHeaders:AddHeader(ItemSortBank) + PLAYER_INVENTORY.inventories[INVENTORY_BANK].sortHeaders:AddHeader(ItemSortBank) - LibSort.ItemSortGuild = WINDOW_MANAGER:CreateControlFromVirtual("ItemSortGuild", ZO_GuildBankSortBy, "ZO_SortHeaderIcon") + LibSort.ItemSortGuild = WINDOW_MANAGER:CreateControlFromVirtual("ItemSortGuild", ZO_GuildBankSortBy, "ZO_SortHeaderIcon") LibSort.ItemSortGuild:SetDimensions(16, 32) LibSort.ItemSortGuild:SetAnchor(RIGHT, ZO_GuildBankSortByName, LEFT, -15) ZO_SortHeader_SetTooltip(LibSort.ItemSortGuild, "Sort", BOTTOMRIGHT, 0, 32) - ZO_SortHeader_InitializeArrowHeader(LibSort.ItemSortGuild, "age", ZO_SORT_ORDER_DOWN) - - PLAYER_INVENTORY.inventories[INVENTORY_GUILD_BANK].sortHeaders:AddHeader(ItemSortGuild) + ZO_SortHeader_InitializeArrowHeader(LibSort.ItemSortGuild, "age", ZO_SORT_ORDER_DOWN) + + PLAYER_INVENTORY.inventories[INVENTORY_GUILD_BANK].sortHeaders:AddHeader(ItemSortGuild) end --- Main functions --- @@ -111,11 +114,14 @@ function LibSort:ProcessInventory(inventoryType) local container = inventoryTypes[inventoryType] if not container then return end for i, slot in ipairs(container.data) do - local slotType, bag, index = slot.data.slotType, slot.data.bagId, slot.data.slotIndex + -- slotType no longer exists, slotType determenes BACKPACK=2,PLAYERBANK=9,GUOLDBANK=10 + -- replaced by bagID BACKPACK=1,PLAYERBANK=2,GUOLDBANK=3 + -- local slotType, bag, index = slot.data.slotType, slot.data.bagId, slot.data.slotIndex + local bag, index = slot.data.bagId, slot.data.slotIndex for addon, callbacks in pairs(self.RegisteredCallbacks) do for name, data in pairs(callbacks) do if not slot.data[data.key] then - slot.data[data.key] = data.func(slotType, bag, index) or defaultType[data.dataType] + slot.data[data.key] = data.func(bag, index) or defaultType[data.dataType] end end end diff --git a/libs/LibStub/LibStub.lua b/libs/LibStub/LibStub.lua index bfd96df..4dbff7b 100644 --- a/libs/LibStub/LibStub.lua +++ b/libs/LibStub/LibStub.lua @@ -1,34 +1,34 @@ --- LibStub is a simple versioning stub meant for use in Libraries. http://www.wowace.com/wiki/LibStub for more info --- LibStub is hereby placed in the Public Domain Credits: Kaelten, Cladhaire, ckknight, Mikk, Ammo, Nevcairiel, joshborke --- LibStub developed for World of Warcraft by above members of the WowAce community. --- Ported to Elder Scrolls Online by Seerah - -local LIBSTUB_MAJOR, LIBSTUB_MINOR = "LibStub", 1 -- NEVER MAKE THIS AN SVN REVISION! IT NEEDS TO BE USABLE IN ALL REPOS! -local LibStub = _G[LIBSTUB_MAJOR] - -local strformat = string.format -if not LibStub or LibStub.minor < LIBSTUB_MINOR then - LibStub = LibStub or {libs = {}, minors = {} } - _G[LIBSTUB_MAJOR] = LibStub - LibStub.minor = LIBSTUB_MINOR - - function LibStub:NewLibrary(major, minor) - assert(type(major) == "string", "Bad argument #2 to `NewLibrary' (string expected)") - minor = assert(tonumber(zo_strmatch(minor, "%d+")), "Minor version must either be a number or contain a number.") - - local oldminor = self.minors[major] - if oldminor and oldminor >= minor then return nil end - self.minors[major], self.libs[major] = minor, self.libs[major] or {} - return self.libs[major], oldminor - end - - function LibStub:GetLibrary(major, silent) - if not self.libs[major] and not silent then - error(("Cannot find a library instance of %q."):strformat(tostring(major)), 2) - end - return self.libs[major], self.minors[major] - end - - function LibStub:IterateLibraries() return pairs(self.libs) end - setmetatable(LibStub, { __call = LibStub.GetLibrary }) -end +-- LibStub is a simple versioning stub meant for use in Libraries. http://www.wowace.com/wiki/LibStub for more info +-- LibStub is hereby placed in the Public Domain Credits: Kaelten, Cladhaire, ckknight, Mikk, Ammo, Nevcairiel, joshborke +-- LibStub developed for World of Warcraft by above members of the WowAce community. +-- Ported to Elder Scrolls Online by Seerah + +local LIBSTUB_MAJOR, LIBSTUB_MINOR = "LibStub", 2 -- NEVER MAKE THIS AN SVN REVISION! IT NEEDS TO BE USABLE IN ALL REPOS! +local LibStub = _G[LIBSTUB_MAJOR] + +local strformat = string.format +if not LibStub or LibStub.minor < LIBSTUB_MINOR then + LibStub = LibStub or {libs = {}, minors = {} } + _G[LIBSTUB_MAJOR] = LibStub + LibStub.minor = LIBSTUB_MINOR + + function LibStub:NewLibrary(major, minor) + assert(type(major) == "string", "Bad argument #2 to `NewLibrary' (string expected)") + minor = assert(tonumber(zo_strmatch(minor, "%d+")), "Minor version must either be a number or contain a number.") + + local oldminor = self.minors[major] + if oldminor and oldminor >= minor then return nil end + self.minors[major], self.libs[major] = minor, self.libs[major] or {} + return self.libs[major], oldminor + end + + function LibStub:GetLibrary(major, silent) + if not self.libs[major] and not silent then + error(strformat("Cannot find a library instance of %q.", tostring(major)), 2) + end + return self.libs[major], self.minors[major] + end + + function LibStub:IterateLibraries() return pairs(self.libs) end + setmetatable(LibStub, { __call = LibStub.GetLibrary }) +end