diff --git a/IIfA/IIfA.lua b/IIfA/IIfA.lua index ba14f40..3aaf55d 100644 --- a/IIfA/IIfA.lua +++ b/IIfA/IIfA.lua @@ -29,6 +29,7 @@ IIfA.TooltipLink = nil IIfA.CurrSceneName = "hud" IIfA.bFilterOnSetName = false IIfA.searchFilter = "" +IIfA.dirtyHouses = {} local LMP = LibStub("LibMediaProvider-1.0") local BACKPACK = ZO_PlayerInventoryBackpack @@ -161,7 +162,7 @@ function IIfA_onLoad(eventCode, addOnName) in2TextColors = IIFA_COLORDEF_DEFAULT:ToHex(), showItemCountOnRight = true, collectHouseData = { - ["All"] = true, + ["All"] = false, }, ignoredCharEquipment = {}, ignoredCharInventories = {}, @@ -175,7 +176,7 @@ function IIfA_onLoad(eventCode, addOnName) ["stables"] = { hidden = false, docked = valDocked, locked = valLocked, minimized = valMinimized, lastX = valLastX, lastY = valLastY, height = valHeight, width = valWidth }, ["trade"] = { hidden = false, docked = valDocked, locked = valLocked, minimized = valMinimized, lastX = valLastX, lastY = valLastY, height = valHeight, width = valWidth }, ["inventory"] = { hidden = false, docked = valDocked, locked = valLocked, minimized = valMinimized, lastX = valLastX, lastY = valLastY, height = valHeight, width = valWidth }, - ["hud"] = { hidden = true, docked = false, locked = valLocked, minimized = valMinimized, lastX = valLastX, lastY = valLastY, height = valHeight, width = valWidth }, + ["hud"] = { hidden = true, docked = false, locked = valLocked, minimized = valMinimized, lastX = valLastX, lastY = valLastY, height = valHeight, width = valWidth }, ["alchemy"] = { hidden = false, docked = valDocked, locked = valLocked, minimized = valMinimized, lastX = valLastX, lastY = valLastY, height = valHeight, width = valWidth } }, diff --git a/IIfA/IIfA.txt b/IIfA/IIfA.txt index aacfd78..4a373d1 100644 --- a/IIfA/IIfA.txt +++ b/IIfA/IIfA.txt @@ -3,9 +3,10 @@ ## Version: 2.20 ## APIVersion: 100021 100022 ## SavedVariables: IIfA_Settings IIfA_Data -## OptionalDependsOn: libFilters +## OptionalDependsOn: libFilters pChat libs\LibStub\LibStub.lua +libs\LibAsync\LibAsync.lua libs\LibCustomTitles\LibCustomTitles.lua libs\LibScroll\LibScroll.lua libs\LibMediaProvider-1.0\LibMediaProvider-1.0.lua diff --git a/IIfA/IIfADataCollection.lua b/IIfA/IIfADataCollection.lua index 17f4227..91d5511 100644 --- a/IIfA/IIfADataCollection.lua +++ b/IIfA/IIfADataCollection.lua @@ -68,7 +68,7 @@ end local function grabBagContent(bagId) - local bagItems = GetBagSize(BAG_BAGPACK) + local bagItems = GetBagSize(bagId) for slotNum=0, bagItems, 1 do dbItem, itemKey = IIfA:EvalBagItem(bagId, slotNum) end @@ -79,8 +79,6 @@ local function scanBags() IIfA.data.accountCharacters = IIfA.data.accountCharacters or {} IIfA.data.accountCharacters[playerName] = IIfA.data.accountCharacters[playerName] or {} - - IIfA:ClearLocationData(IIfA.currentCharacterId) @@ -116,7 +114,6 @@ function IIfA:OnFirstInventoryOpen() IIfA.OnFirstInventoryOpen = function() return end end - function IIfA:CheckForAgedGuildBankData( days ) local results = false local days = days or 5 @@ -230,9 +227,15 @@ end -function IIfA:ScanHouse() +function IIfA:ScanHouse(reset) + local houseCollectibleId = GetCollectibleIdForHouse(GetCurrentZoneHouseId()) if not IIfA:GetTrackedBags()[houseCollectibleId] then return end + + if reset then + IIfA:ClearLocationData(houseCollectibleId) + end + local function getAllPlacedFurniture() local ret = {} @@ -251,9 +254,9 @@ function IIfA:ScanHouse() local houseCollectibleId = GetCollectibleIdForHouse(GetCurrentZoneHouseId()) local items = getAllPlacedFurniture() for itemLink, itemCount in pairs(items) do - IIfA:AddOrRemoveFurnitureItem(itemLink, itemCount, houseCollectibleId, true) + IIfA:AddFurnitureItem(itemLink, itemCount, houseCollectibleId, true) end - IIfA.Furniture = items + end local function assertValue(value, itemLink, getFunc) @@ -285,7 +288,7 @@ local function setItemFileEntry(array, key, value) end function IIfA:AddOrRemoveFurnitureItem(itemLink, itemCount, houseCollectibleId, fromInitialize) - + -- d(zo_strformat("trying to add/remove <<1>> x <<2>> from houseCollectibleId <<3>>", itemLink, itemCount, houseCollectibleId)) local location = houseCollectibleId IIfA:EvalBagItem(houseCollectibleId, IIfA:GetItemID(itemLink), false, itemCount, itemLink, GetItemLinkName(itemLink), houseCollectibleId) end @@ -326,8 +329,14 @@ function IIfA:EvalBagItem(bagId, slotNum, fromXfer, itemCount, itemLink, itemNam itemKey = IIfA:GetItemID(itemLink) end end - - local _, qty, _, _, _, equipType, _, itemQuality = GetItemInfo(bagId, slotNum) + local qty, equipType, itemQuality + if not itemLink then + _, qty, _, _, _, equipType, _, itemQuality = GetItemInfo(bagId, slotNum) + else + qty = 1 + equipType = GetItemLinkEquipType(itemLink) + itemQuality = GetItemLinkQuality(itemLink) + end itemCount = itemCount or qty itemFilterType = GetItemFilterTypeInfo(bagId, slotNum) or 0 DBitem = DBv3[itemKey] diff --git a/IIfA/IIfAEvents.lua b/IIfA/IIfAEvents.lua index d45c591..65c00a8 100644 --- a/IIfA/IIfAEvents.lua +++ b/IIfA/IIfAEvents.lua @@ -63,27 +63,18 @@ local function IIfA_CollectibleUpdate(eventCode, collectibleId, justUnlocked) end -local function IIfA_FurnitureAdd(eventCode, furnitureId, collectibleId) - if nil == furnitureId then return end - local houseCollectibleId = GetCollectibleIdForHouse(GetCurrentZoneHouseId()) - if not IIfA:GetTrackedBags()[houseCollectibleId] then return end - IIfA:AddOrRemoveFurnitureItem(itemLink, 1, houseCollectibleId, true) +local function IIfA_ScanHouse(eventCode, oldMode, newMode) + if newMode == "showing" or newMode == "shown" then return end + IIfA:ScanHouse(true) end - -local function IIfA_FurnitureRemove(eventCode, furnitureId, collectibleId) - if nil == furnitureId then return end - local houseCollectibleId = GetCollectibleIdForHouse(GetCurrentZoneHouseId()) - if not IIfA:GetTrackedBags()[houseCollectibleId] then return end - IIfA:AddOrRemoveFurnitureItem(itemLink, -1, houseCollectibleId, true) -end - -local function IIfA_HouseEntered(eventCode) - +local function IIfA_HouseEntered(eventCode) if not IsOwnerOfCurrentHouse() then return end IIfA:ScanHouse() end - +local function IIfA_ScanBank() + IIfA:ScanBank() +end local function IIfA_EventProc(...) --d(...) local l = {...} @@ -159,6 +150,7 @@ function IIfA:RegisterForEvents() -- Events for data collection EVENT_MANAGER:RegisterForEvent("IIFA_ALPUSH", EVENT_ACTION_LAYER_PUSHED, IIfA_ActionLayerInventoryUpdate) + EVENT_MANAGER:RegisterForEvent("IIFA_ON_BANK_OPEN", EVENT_OPEN_BANK , IIfA_ScanBank) -- on opening guild bank: EVENT_MANAGER:RegisterForEvent("IIFA_GUILDBANK_LOADED", EVENT_GUILD_BANK_ITEMS_READY, IIfA_GuildBankDelayReady) @@ -171,24 +163,21 @@ function IIfA:RegisterForEvents() -- on adding or removing an item from the guild bank: - EVENT_MANAGER:RegisterForEvent("IIFA_GUILDBANK_ITEM_ADDED", EVENT_GUILD_BANK_ITEM_ADDED, IIfA_GuildBankAddRemove) + EVENT_MANAGER:RegisterForEvent("IIFA_GUILDBANK_ITEM_ADDED", EVENT_GUILD_BANK_ITEM_ADDED, IIfA_GuildBankAddRemove) EVENT_MANAGER:RegisterForEvent("IIFA_GUILDBANK_ITEM_REMOVED", EVENT_GUILD_BANK_ITEM_REMOVED, IIfA_GuildBankAddRemove) - EVENT_MANAGER:RegisterForEvent("IIFA_HOUSING_PLAYER_INFO_CHANGED", EVENT_PLAYER_ACTIVATED , IIfA_HouseEntered) - EVENT_MANAGER:RegisterForEvent("IIFA_HOUSING_FURNITURE_REMOVED", EVENT_HOUSING_FURNITURE_REMOVED, IIfA_FurnitureRemove) - EVENT_MANAGER:RegisterForEvent("IIFA_HOUSING_FURNITURE_PLACED", EVENT_HOUSING_FURNITURE_PLACED, IIfA_FurnitureAdd) - + EVENT_MANAGER:RegisterForEvent("IIFA_HOUSING_PLAYER_INFO_CHANGED", EVENT_PLAYER_ACTIVATED, IIfA_HouseEntered) + EVENT_MANAGER:RegisterForEvent("IIfA_HOUSE_MANAGER_MODE_CHANGED", EVENT_HOUSING_EDITOR_MODE_CHANGED, IIfA_ScanHouse) local function RebuildOptionsMenu() self:CreateOptionsMenu() end EVENT_MANAGER:RegisterForEvent("IIFA_GuildJoin", EVENT_GUILD_SELF_JOINED_GUILD, RebuildOptionsMenu) EVENT_MANAGER:RegisterForEvent("IIFA_GuildLeave", EVENT_GUILD_SELF_LEFT_GUILD, RebuildOptionsMenu) - --- ZO_QuickSlot:RegisterForEvent(EVENT_ABILITY_COOLDOWN_UPDATED, IIfA_EventDump) - + SHARED_INVENTORY:RegisterCallback("SingleSlotInventoryUpdate", IIFA_OnSingleSlotInventoryUpdate) +-- ZO_QuickSlot:RegisterForEvent(EVENT_ABILITY_COOLDOWN_UPDATED, IIfA_EventDump) ZO_PreHook('ZO_InventorySlot_ShowContextMenu', function(rowControl) IIfA_OnRightClickUp(rowControl) end) end