View Feature Request
Inventory container autoloot disabling for locked items
Feature #: 667
File: FCO ItemSaver
Date: 06/19/15 04:55 AM
By: Sparq
Status: Feature Implemented
The autoloot feature is great, but has one big drawback, it makes it very easy to accidentally open a container bag in your inventory, exploding its items in your inventory with no way to undo it. The main example here is the "X Treasure Map" containers which you get when you create a new account, which you really don't want to open with autoloot on.

So I slightly modified your addon with the following function:
Lua Code:
  1. local function IsAutolootContainer(bag, slot)
  2.     return (IsGetItemType(bag, slot) == ITEMTYPE_CONTAINER and GetSetting(SETTING_TYPE_LOOT, LOOT_SETTING_AUTO_LOOT) == "1")
  3. end

Added a clause in ItemSelectionHandler:
Lua Code:
  1. --Are we at the inventory and trying to use/equip an item?
  2.     elseif (not ZOControlVars.BACKPACK:IsHidden() or locVars.gFilterWhere == INV_BAGS) then
  3.       --Are we trying to open a container with autoloot on?
  4.       if (IsAutolootContainer(bag, slot)) then
  5.         whereAreWe = 13
  6.       else
  7.         return false
  8.       end
Where "13" is the "Autolooting container not allowed" block message type.

In AddContextMenuCallback I remove "use" from locked containers when autoloot is on:
Lua Code:
  1. --Use item?
  2. if actionStringId == SI_ITEM_ACTION_USE then
  3.   --If mail send or player trade panel is activated
  4.   local isCurrentlyShowingMailSend = not ZOControlVars.MAIL_SEND:IsHidden()
  5.   local isCurrentlyShowingPlayerTrade = not ZOControlVars.PLAYER_TRADE:IsHidden()
  6.   local isAutolootContainer = IsAutolootContainer(bag, slotIndex)
  7.   if isCurrentlyShowingMailSend or isCurrentlyShowingPlayerTrade or isAutolootContainer then
  8.     --Is the item currently usable?
  9.     if IsItemUsable(bag, slotIndex) then
  10.       --Is the item protected with any icon?
  11.       local marked, _ = FCOIsMarked(GetItemInstanceId(bag, slotIndex), -1)
  12.       if marked then
  13.         if isCurrentlyShowingPlayerTrade and settingsVars.settings.blockTrading then
  14.           --remove the context-menu entry for "use" (and the keybinding)
  15.           return true
  16.         elseif isCurrentlyShowingMailSend and settingsVars.settings.blockSendingByMail then
  17.           --remove the context-menu entry for "use" (and the keybinding)
  18.           return true
  19.         elseif isAutolootContainer then
  20.           --remove the context-menu entry for "use" (and the keybinding)
  21.           return true
  22.         end
  23.       end
  24.     end
  25.   end
  26. end

As the above is a proof of concept, it is still missing the config setting to enable/disable blocking autoloot, and the autoloot blocking specific translatable message.

I hope you can include this, it would certainly help me from opening those Treasure Map containers :)

RSS 2.0 Feed for Favorite CommentsNotes Sort Options
By: Baertram - 06/19/15 12:35 PM
Thx for the idea, I like it.

So you only want to disable the automatic opening of containers that you loot if autoloot is enabled in ESO settings.
And you wish to enable/disable this with a setting then.

I'll see when I get the time to test your source code changes and add the needed translations + settings.
By: Sparq - 06/20/15 05:18 PM
Indeed, this mainly means that if you lock/mark a container, you will no longer be able to "destroy" it by opening it with autoloot on.

I have a separate addon that I will probably put up on esoui soon that adds a "peek" action to the container menu item, which will allow you to peek into a container as if autoloot is off when you have autoloot on.

I originally perused your addon to see how you overrode the default actions so that I could disable autolooting containers altogether. But I also have containers that I do want to autoloot (writ rewards for example), so that meant I needed to mark containers for "no autolooting". In the end adding this feature to your addon instead of mine was the easier option :P

My addon combined with your addon will make it possible to lock my treasure map containers, but still be able to pick and choose specific treasure maps from the containers. All while autoloot is on.
By: Baertram - 06/22/15 09:53 AM
Sounds good, wished ZOs had implemented some more options beside "loot all" or "loot nothing (loot manually)" :-)

As I said I don't know when I'll find the time to implement it, sorry. I'm quite busy with private life atm.

But as the main code is already presented, thanks to you, I hope it'll be some quiet hour where I can implement and test it/let you test it.
By: Baertram - 06/22/15 12:55 PM
Added the option to release 0.6.9
Would be glad if we can implement support for your addon ContainerPeek too so ppl can just double click the containers and see the loot window if the option is enabled.