Thread Tools Display Modes
Prev Previous Post   Next Post Next
04/07/15, 05:57 PM   #1
AddOn Author - Click to view addons
Join Date: May 2014
Posts: 613
[open] Search Box Bug

I have found 2 more bugs in the searchBox game code and added them to this post.

If you unequip an item by double clicking on it in the character window (or right clicking and selected unequip) everything works fine.

But when you double click an item to equip it & you already have an item equiped in that equip slot, they just swap slots and the searchData does not get updated and still has the cached searchData for the old item.

Steps to Reproduce:
  1. Log in or /reloadui to clear searchData.cache for all slots
  2. Do a search in the search box so that it will cache search data in to each slot.searchData.cache
  3. Double click on an item to equip it AND you must already have an item equipped in that slot so they swap slots !!
  4. The item that was unequipped was placed in the inventory slot of the item you equipped & it still contains the old searchData.cache.
  5. Try to search for the name of the item you EQUIPPED (yes its not in your inventory you equipped it, but) it will display the item that was UNEQUIPPED in the search results...because it has the searchData.cache for the old item.

  • I "HAD" the "Ironthread Jerkin" equipped
  • I double clicked on the "Robe of the Magic Furnace" (now it is equipped)
  • Then I /zgoo'd the row control for the "Ironthread Jerkin" that got unequipped.
  • We can see the slot data shows the "Ironthread Jerkin", but the searchData still has the cached data for the "Robe of the Magic Furnace"
  • When I search for "Robe of the Magic Furnace" the "Ironthread Jerkin" appears

It looks like you need to clear the searchData.cache & set searchData.cached to false when the slots are updated with a different item, something like:

Lua Code:
  1. function ZO_SharedInventoryManager:CreateOrUpdateSlotData(existingSlotData, bagId, slotIndex, isNewItem)
  2.     ...
  3.     if not wasSameItemInSlotBefore then
  4.         slot.itemType = GetItemType(bagId, slotIndex)
  5.         slot.uniqueId = GetItemUniqueId(bagId, slotIndex)
  7.         --------------------------------------
  8.         -- Add these to clear the old cache --
  9.         --------------------------------------
  10.         local searchData = slot.searchData
  12.         if searchData.cached then
  13.             searchData.cache = nil
  14.             searchData.cached = false
  15.         end
  16.         --------------------------------------
  17.         --------------------------------------
  18.     end
  20.     ...
  21. end

I'm not sure when this broke, but the search box does NOT work in the guild bank.

The virtual control that is inherited by all inventory search boxes comes from this control:
Lua Code:
  1. <EditBox name="ZO_InventorySearchBox" font="ZoFontWinT1" inherits="ZO_DefaultEdit ZO_EditDefaultText" virtual="true">
  2.    ...
  3.     <OnTextChanged>
  4.         ZO_EditDefaultText_OnTextChanged(self)
  5.         ZO_PlayerInventory_OnSearchTextChanged(self)
  6.     </OnTextChanged>
  7.     ...

which calls:
Lua Code:
  1. ZO_PlayerInventory_OnSearchTextChanged(self)

But it only updates the backpack or bank.
Lua Code:
  1. function ZO_PlayerInventory_OnSearchTextChanged(editBox)
  2.     if(editBox == ZO_PlayerInventorySearchBox) then
  3.         PlayerInventory:UpdateList(PlayerInventory.selectedTabType)
  4.     else
  5.         PlayerInventory:UpdateList(INVENTORY_BANK)
  6.     end
  7. end

Fix: It should be
Lua Code:
  1. function ZO_PlayerInventory_OnSearchTextChanged(editBox)
  2.     if(editBox == ZO_PlayerInventorySearchBox) then
  3.         PlayerInventory:UpdateList(PlayerInventory.selectedTabType)
  4.     elseif (editBox == ZO_PlayerBankSearchBox) then
  5.         PlayerInventory:UpdateList(INVENTORY_BANK)
  6.     else
  7.         PlayerInventory:UpdateList(INVENTORY_GUILD_BANK)
  8.     end
  9. end

In inventory.lua, when the "guildbank" scene is registered for the "StateChange" callback it Ends the search for the wrong searchBox. Which means the searchBox for the guild bank does not get cleared properly.
Lua Code:
  1. local guildBankScene = ZO_InteractScene:New("guildBank", SCENE_MANAGER, GUILD_BANKING_INTERACTION)
  2. guildBankScene:RegisterCallback("StateChange",  function(oldState, newState)
  3.     if(newState == SCENE_SHOWING) then
  4.         self:RefreshMoney(GetCurrentMoney())
  5.         self:RefreshAlliancePoints(GetAlliancePoints())
  6.         guildBankFragmentBar:SelectFragment(SI_BANK_WITHDRAW)
  7.         ZO_SharedInventory_SelectAccessibleGuildBank(self.lastSuccessfulGuildBankId)
  8.     elseif(newState == SCENE_HIDDEN) then
  9.         guildBankFragmentBar:Clear()
  10.         ZO_InventorySlot_RemoveMouseOverKeybinds()
  12.         --============================================================--
  13.         -- This line is incorrect.
  14.         --ZO_PlayerInventory_EndSearch(ZO_PlayerBankSearchBox)
  15.         -- It should be:
  16.         ZO_PlayerInventory_EndSearch(ZO_GuildBankSearchBox)
  17.         --============================================================--
  18.     end
  19. end)

For anyone interested I have added a fix for the two new bugs I found to my SearchBox Bug Fix addon, you can find it here: SearchBox Bug Fix V3.0

Last edited by circonian : 04/10/15 at 05:42 PM.
  Reply With Quote

ESOUI » Developer Discussions » Bug Reports » [open] Search Box Bug

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off