diff --git a/IIfA/IIfA.lua b/IIfA/IIfA.lua index d9cc03d..590bd7b 100644 --- a/IIfA/IIfA.lua +++ b/IIfA/IIfA.lua @@ -460,7 +460,7 @@ function IIfA_onLoad(eventCode, addOnName) local worldName = GetWorldName():gsub(" Megaserver", "") IIfA.data[worldName] = IIfA.data[worldName] or {} if nil == IIfA.data[worldName].DBv3 then - IIfA.data[GetWorldName()].DBv3 = IIfA.data.DBv3 + IIfA.data[worldName].DBv3 = IIfA.data.DBv3 end IIfA.database = IIfA.data[worldName].DBv3 diff --git a/IIfA/IIfABackpack.lua b/IIfA/IIfABackpack.lua index 22775ea..d7fdebd 100644 --- a/IIfA/IIfABackpack.lua +++ b/IIfA/IIfABackpack.lua @@ -51,7 +51,7 @@ function IIfA:SetActiveFilter(value) enableFilterButton(value) IIfA:UpdateScrollDataLinesData() - + IIfA:UpdateInventoryScroll() end function IIfA:GetActiveSubFilter() @@ -67,6 +67,7 @@ function IIfA:SetActiveSubFilter(value) IIfA.activeSubFilter = value end IIfA:UpdateScrollDataLinesData() + IIfA:UpdateInventoryScroll() end @@ -401,7 +402,7 @@ function IIfA:UpdateScrollDataLinesData() IIFA_GUI_ListHolder.dataLines = dataLines sort(IIFA_GUI_ListHolder.dataLines) IIFA_GUI_ListHolder.dataOffset = 0 - IIfA:UpdateInventoryScroll() + end @@ -544,11 +545,9 @@ function IIfA:CreateInventoryScroll() IIfA:SetItemCountPosition() end - IIfA:UpdateScrollDataLinesData() - -- setup slider --- local tex = "/esoui/art/miscellaneous/scrollbox_elevator.dds" --- IIFA_GUI_ListHolder_Slider:SetThumbTexture(tex, tex, tex, 16, 50, 0, 0, 1, 1) + -- local tex = "/esoui/art/miscellaneous/scrollbox_elevator.dds" + -- IIFA_GUI_ListHolder_Slider:SetThumbTexture(tex, tex, tex, 16, 50, 0, 0, 1, 1) IIFA_GUI_ListHolder_Slider:SetMinMax(0, #IIFA_GUI_ListHolder.dataLines - IIFA_GUI_ListHolder.maxLines) return IIFA_GUI_ListHolder.lines @@ -687,91 +686,91 @@ function IIfA:QueryAccountInventory(itemLink) return queryItem end -local function createInventoryDropdown() - local comboBox, i +function IIfA:SetSceneVisible(name, value) + IIfA:GetSettings().frameSettings[name].hidden = not value +end - if IIFA_GUI_Header_Dropdown.comboBox ~= nil then - comboBox = IIFA_GUI_Header_Dropdown.comboBox +function IIfA:GetSceneVisible(name) + if IIfA:GetSettings().frameSettings then + return (not IIfA:GetSettings().frameSettings[name].hidden) else - comboBox = ZO_ComboBox_ObjectFromContainer(IIFA_GUI_Header_Dropdown) - IIFA_GUI_Header_Dropdown.comboBox = comboBox + return true end +end - function OnItemSelect(_, choiceText, choice) --- d("OnItemSelect", choiceText, choice) - IIfA:SetInventoryListFilter(choiceText) - PlaySound(SOUNDS.POSITIVE_CLICK) - end - comboBox:SetSortsItems(false) - local validChoices = IIfA:GetAccountInventoryList() +function IIfA:SetupBackpack() - for i = 1, #validChoices do - entry = comboBox:CreateItemEntry(validChoices[i], OnItemSelect) - comboBox:AddItem(entry) - if validChoices[i] == IIfA:GetInventoryListFilter() then - comboBox:SetSelectedItem(validChoices[i]) + local function createInventoryDropdown() + local comboBox, i + + if IIFA_GUI_Header_Dropdown.comboBox ~= nil then + comboBox = IIFA_GUI_Header_Dropdown.comboBox + else + comboBox = ZO_ComboBox_ObjectFromContainer(IIFA_GUI_Header_Dropdown) + IIFA_GUI_Header_Dropdown.comboBox = comboBox end - end - return IIFA_GUI_Header_Dropdown -end + function OnItemSelect(_, choiceText, choice) + -- d("OnItemSelect", choiceText, choice) + IIfA:SetInventoryListFilter(choiceText) + PlaySound(SOUNDS.POSITIVE_CLICK) + end + comboBox:SetSortsItems(false) -local function createInventoryDropdownQuality() - local comboBox, i + local validChoices = IIfA:GetAccountInventoryList() - IIFA_GUI_Header_Dropdown_Quality.comboBox = IIFA_GUI_Header_Dropdown_Quality.comboBox or ZO_ComboBox_ObjectFromContainer(IIFA_GUI_Header_Dropdown_Quality) + for i = 1, #validChoices do + entry = comboBox:CreateItemEntry(validChoices[i], OnItemSelect) + comboBox:AddItem(entry) + if validChoices[i] == IIfA:GetInventoryListFilter() then + comboBox:SetSelectedItem(validChoices[i]) + end + end + + return IIFA_GUI_Header_Dropdown + end - local validChoices = {} - table.insert(validChoices, "Any") - table.insert(validChoices, getColoredString(ITEM_QUALITY_TRASH, "Junk")) - table.insert(validChoices, getColoredString(ITEM_QUALITY_NORMAL, "Normal")) - table.insert(validChoices, getColoredString(ITEM_QUALITY_MAGIC, "Magic")) - table.insert(validChoices, getColoredString(ITEM_QUALITY_ARCANE, "Arcane")) - table.insert(validChoices, getColoredString(ITEM_QUALITY_ARTIFACT, "Artifact")) - table.insert(validChoices, getColoredString(ITEM_QUALITY_LEGENDARY, "Legendary")) + local function createInventoryDropdownQuality() + local comboBox, i - local comboBox = IIFA_GUI_Header_Dropdown_Quality.comboBox + IIFA_GUI_Header_Dropdown_Quality.comboBox = IIFA_GUI_Header_Dropdown_Quality.comboBox or ZO_ComboBox_ObjectFromContainer(IIFA_GUI_Header_Dropdown_Quality) - function OnItemSelect(_, choiceText, choice) - IIfA:SetInventoryListFilterQuality(getQualityDict()[choiceText]) - PlaySound(SOUNDS.POSITIVE_CLICK) - end + local validChoices = {} + table.insert(validChoices, "Any") + table.insert(validChoices, getColoredString(ITEM_QUALITY_TRASH, "Junk")) + table.insert(validChoices, getColoredString(ITEM_QUALITY_NORMAL, "Normal")) + table.insert(validChoices, getColoredString(ITEM_QUALITY_MAGIC, "Magic")) + table.insert(validChoices, getColoredString(ITEM_QUALITY_ARCANE, "Arcane")) + table.insert(validChoices, getColoredString(ITEM_QUALITY_ARTIFACT, "Artifact")) + table.insert(validChoices, getColoredString(ITEM_QUALITY_LEGENDARY, "Legendary")) - comboBox:SetSortsItems(false) + local comboBox = IIFA_GUI_Header_Dropdown_Quality.comboBox - for i = 1, #validChoices do - entry = comboBox:CreateItemEntry(validChoices[i], OnItemSelect) - comboBox:AddItem(entry) - if getQualityDict()[validChoices[i]] == IIfA:GetInventoryListFilterQuality() then - comboBox:SetSelectedItem(validChoices[i]) + function OnItemSelect(_, choiceText, choice) + IIfA:SetInventoryListFilterQuality(getQualityDict()[choiceText]) + PlaySound(SOUNDS.POSITIVE_CLICK) end - end - return IIFA_GUI_Header_Dropdown -end + comboBox:SetSortsItems(false) -function IIfA:SetSceneVisible(name, value) - IIfA:GetSettings().frameSettings[name].hidden = not value -end + for i = 1, #validChoices do + entry = comboBox:CreateItemEntry(validChoices[i], OnItemSelect) + comboBox:AddItem(entry) + if getQualityDict()[validChoices[i]] == IIfA:GetInventoryListFilterQuality() then + comboBox:SetSelectedItem(validChoices[i]) + end + end -function IIfA:GetSceneVisible(name) - if IIfA:GetSettings().frameSettings then - return (not IIfA:GetSettings().frameSettings[name].hidden) - else - return true + return IIFA_GUI_Header_Dropdown end -end - - -function IIfA:SetupBackpack() IIfA.InventoryListFilter = IIfA.data.in2DefaultInventoryFrameView IIfA:CreateInventoryScroll() createInventoryDropdown() - createInventoryDropdownQuality() + createInventoryDropdownQuality() IIfA:GuiOnSort(true) end diff --git a/IIfA/IIfADataCollection.lua b/IIfA/IIfADataCollection.lua index 4b7c2f9..277c3f1 100644 --- a/IIfA/IIfADataCollection.lua +++ b/IIfA/IIfADataCollection.lua @@ -390,12 +390,14 @@ function IIfA:EvalBagItem(bagId, slotNum, fromXfer, itemCount, itemLink, itemNam if itemName == "" then if nil ~= IIfA.BagSlotInfo[bagId] and nil ~= IIfA.BagSlotInfo[bagId][slotNum] then itemLink = IIfA.BagSlotInfo[bagId][slotNum] - itemName = GetItemLinkItemName(bagId, slotNum) + itemName = GetItemLinkName(bagId, slotNum) end end - + if not itemCount then + _, itemCount = GetItemInfo(bagId, slotNum) + end - IIfA:DebugOut(zo_strformat("EvalBagItem bagId/slotId: <<1>>/<<2>> itemName: <<3>>", bagId, slotNum, itemName)) + -- IIfA:DebugOut(zo_strformat("EvalBagItem bagId/slotId: <<1>>/<<2>> name/count: <<3>> x <<4>>", bagId, slotNum, itemName, itemCount)) if itemName > EMPTY_STRING then itemLink = itemLink or GetItemLink(bagId, slotNum, LINK_STYLE_BRACKETS) @@ -438,7 +440,7 @@ function IIfA:EvalBagItem(bagId, slotNum, fromXfer, itemCount, itemLink, itemNam elseif(bagId == BAG_BANK or bagId == BAG_SUBSCRIBER_BANK) then location = GetString(IIFA_BAG_BANK) elseif(bagId == BAG_VIRTUAL) then - location =GetString(IIFA_BAG_CRAFTBAG) + location = GetString(IIFA_BAG_CRAFTBAG) elseif(bagId == BAG_GUILDBANK) then location = GetGuildName(GetSelectedGuildBankId()) elseif GetAPIVersion() >= 100022 and 0 < GetCollectibleForHouseBankBag(bagId) then @@ -514,8 +516,8 @@ function IIfA:ValidateItemCounts(bagID, slotNum, dbItem, itemKey, itemLinkOverri if itemLinkCheck ~= itemLink then if bagID ~= data.bagID and slotNum ~= data.bagSlot then -- d("should remove " .. itemLink .. " from " .. locName) - -- it's no longer the same item, or it's not there at all - self.data.DBv3[itemKey].locations[locName] = nil + -- it's no longer the same item, or it's not there at all + IIfA.database[itemKey].locations[locName] = nil end end end diff --git a/IIfA/IIfA_xml_adapter.lua b/IIfA/IIfA_xml_adapter.lua index 2ccf01c..41282ca 100644 --- a/IIfA/IIfA_xml_adapter.lua +++ b/IIfA/IIfA_xml_adapter.lua @@ -312,6 +312,7 @@ function IIfA:GuiOnSort(initialised) icon:SetAlpha(1) end IIfA:UpdateScrollDataLinesData() + IIfA:UpdateInventoryScroll() end function IIfA:GuiOnScroll(control, delta)