Quantcast
Download
(10 Kb)
Download
Updated: 05/26/21 12:13 AM
Pictures
File Info
Compatibility:
Blackwood (7.0.5)
Flames of Ambition (6.3.5)
Updated:05/26/21 12:13 AM
Created:05/16/21 12:49 PM
Monthly downloads:579
Total downloads:652
Favorites:8
MD5:
7.0.5
Take One
Version: 1.1.1
by: mightyjo [More]
Take One
Author: Mightyjo

Depends on:
- LibAddonMenu-2.0
- LibCustomMenu
- LibDebugLogger

Optionally depends on:
- DebugLogViewer

This add-on provides a context menu option to pull one item from a Bank or Guild Bank stack into your inventory.

The context menu item will only appear when all the preconditions to use it are met
- The source slot is in your Bank or Guild Bank.
- You have permission to withdraw and deposit into the Guild Bank.
- You have 2 free backpack slots (for Guild Bank withdrawals).
- The source stack contains more than 1 item.

Requires 2 free slots in your backpack
When working with the Guild Bank it really just automates the process of withdrawing the whole stack in a bank slot, splitting out one item from the stack, and returning the remaining stack to the Guild Bank. Consequently, you must have 2 free slots in your backpack to withdraw 1 item from a Guild Bank stack. Annoying, but that's what the API allows.

Settings
You can turn on debug logging if you're having a problem. If you have DebugLogViewer installed you'll be able to see the add-on working in a UI window. Otherwise, the log is stored in your saved variables by LibDebugLogger whenever you quit or /reloadui.

Support
If you need help, find a bug, or have a translation post here. You can also open an issue or pull request on the GitHub: https://github.com/Mightyjo/TakeOne/issues.


Thanks
Many thanks to the authors whose examples I followed:
- @Marify
- Valandil
- @Architectura
- @Magnum1997
- Wobin
- CrazyDutchGuy
- Ayantir
- silvereyes
- Baertram

License



This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.
Archived Files (4)
File Name
Version
Size
Uploader
Date
1.1.0
10kB
mightyjo
05/25/21 11:02 PM
1.0.2
9kB
mightyjo
05/21/21 06:14 PM
1.0.1
9kB
mightyjo
05/20/21 09:57 PM
1.0.0
9kB
05/16/21 12:49 PM


Post A Reply Comment Options
Unread 05/26/21, 12:17 AM  
mightyjo
AddOn Author - Click to view AddOns

Forum posts: 1
File comments: 12
Uploads: 1
v1.1.1

Everything is fine. Nothing is ruined. Hope nobody saw that embarrassing display.
Report comment to moderator  
Reply With Quote
Unread 05/25/21, 11:41 PM  
mightyjo
AddOn Author - Click to view AddOns

Forum posts: 1
File comments: 12
Uploads: 1
Broke something in v1.1.0

Just broke something. I'll have it fixed in a jiffy.
Report comment to moderator  
Reply With Quote
Unread 05/24/21, 10:42 PM  
arps

Forum posts: 0
File comments: 8
Uploads: 0
thanks

great addon thank you so much!
Report comment to moderator  
Reply With Quote
Unread 05/22/21, 12:21 PM  
mightyjo
AddOn Author - Click to view AddOns

Forum posts: 1
File comments: 12
Uploads: 1
Originally Posted by Baertram
Could be that the action slot function was causing the problems with the context menu. I had asked Votan already a few weeks ago about this, as another addon "CustomItemNote" got the same problem using the action slot example from LibCustomMenu with LibCustomMenu.CATEGORY_LATE.
Maybe he found the problm and knows a fix then.

If you try the same, LibCustomMenu.CATEGORY_LATE, but only use AddCustomMenuItem it should work properly.
Yep! It works correctly now. Uploaded the fix last night. Thanks again!
Report comment to moderator  
Reply With Quote
Unread 05/22/21, 09:51 AM  
Baertram
 
Baertram's Avatar
AddOn Author - Click to view AddOns

Forum posts: 3542
File comments: 4330
Uploads: 68
I used LibCustomMenu.CATEGORY_LATE in v1.0.0 when the menus got clobbered. I take your point, though. I was concerned using CATEGORY_PRIMARY would be fragile. I'm betting your next tip sets this all straight.
Could be that the action slot function was causing the problems with the context menu. I had asked Votan already a few weeks ago about this, as another addon "CustomItemNote" got the same problem using the action slot example from LibCustomMenu with LibCustomMenu.CATEGORY_LATE.
Maybe he found the problm and knows a fix then.

If you try the same, LibCustomMenu.CATEGORY_LATE, but only use AddCustomMenuItem it should work properly.
Last edited by Baertram : 05/22/21 at 09:52 AM.
Report comment to moderator  
Reply With Quote
Unread 05/21/21, 05:27 PM  
mightyjo
AddOn Author - Click to view AddOns

Forum posts: 1
File comments: 12
Uploads: 1
Thanks Baetram! You cleared up a bunch of questions I'd been trying to feel my way through.

Originally Posted by Baertram
If you use LibCustomMenu "properly" to register an inventory context menu this shouldn't be any problem.
You shouldn't palce your entries behind special other entries but just use the lib's constants (e.g. LibCustomMenu.CATEGORY_PRIMARY like you do now) for add early, or late e.g.
Else you'll always run into the same problems with many addons using the lib.
I used LibCustomMenu.CATEGORY_LATE in v1.0.0 when the menus got clobbered. I take your point, though. I was concerned using CATEGORY_PRIMARY would be fragile. I'm betting your next tip sets this all straight.

Originally Posted by Baertram
btw if your entry to the contextmenu does NOT use any keybindings you can simply use your function TakeOne:ShowContextMenu(inventorySlot, slotActions)
and add a new contextmenu entry like this:

AddCustomMenuItem(...)
or
AddCustomSubMenuItem(...) if you want to show your entries inside a submenu.

instead of using slotActions:AddCustomSlotAction(...)

Lua Code:
  1. function TakeOne:ShowContextMenu(inventorySlot, slotActions)
  2.  
  3.     -- Check inventorySlot validity
  4.     if not self:isValid(inventorySlot) then
  5.         return
  6.     end
  7.  
  8.     local bagId, slotIndex = ZO_Inventory_GetBagAndIndex(inventorySlot)
  9.     local itemLink = GetItemLink(bagId, slotIndex)
  10.     local itemId = GetItemLinkItemId(itemLink)
  11.  
  12.     self:Debug(" BagID: <<1>>;  slotIndex: <<2>>; itemId: <<3>>", bagId, slotIndex, itemId)
  13.     --slotActions:AddCustomSlotAction(TO_CONTEXT_MENU, function() self:DoTake(inventorySlot, itemId) end, "")
  14.     AddCustomMenuItem(TO_CONTEXT_MENU, function() self:DoTake(inventorySlot, itemId) end)
  15.  
  16. end

The slot action changes is only needed if you also want to change the slot stuff like add a keybinding for it.
Ah, thanks! I misinterpreted the examples to mean RegisterContextMenu and AddCustomSlotAction were paired. Much obliged.

Originally Posted by Baertram
btw: your variable for the character SVs are never used: self.savedCharVariables
You should remove them so they do not create the tables in the SV files for nothing.
Copy that. The Debug function in LibMarify uses the SVs. I'll look for a lighter-weight solution.
Report comment to moderator  
Reply With Quote
Unread 05/21/21, 08:59 AM  
Baertram
 
Baertram's Avatar
AddOn Author - Click to view AddOns

Forum posts: 3542
File comments: 4330
Uploads: 68
If you use LibCustomMenu "properly" to register an inventory context menu this shouldn't be any problem.
You shouldn't palce your entries behind special other entries but just use the lib's constants (e.g. LibCustomMenu.CATEGORY_PRIMARY like you do now) for add early, or late e.g.
Else you'll always run into the same problems with many addons using the lib.

btw if your entry to the contextmenu does NOT use any keybindings you can simply use your function TakeOne:ShowContextMenu(inventorySlot, slotActions)
and add a new contextmenu entry like this:

AddCustomMenuItem(...)
or
AddCustomSubMenuItem(...) if you want to show your entries inside a submenu.

instead of using slotActions:AddCustomSlotAction(...)

Lua Code:
  1. function TakeOne:ShowContextMenu(inventorySlot, slotActions)
  2.  
  3.     -- Check inventorySlot validity
  4.     if not self:isValid(inventorySlot) then
  5.         return
  6.     end
  7.  
  8.     local bagId, slotIndex = ZO_Inventory_GetBagAndIndex(inventorySlot)
  9.     local itemLink = GetItemLink(bagId, slotIndex)
  10.     local itemId = GetItemLinkItemId(itemLink)
  11.  
  12.     self:Debug(" BagID: <<1>>;  slotIndex: <<2>>; itemId: <<3>>", bagId, slotIndex, itemId)
  13.     --slotActions:AddCustomSlotAction(TO_CONTEXT_MENU, function() self:DoTake(inventorySlot, itemId) end, "")
  14.     AddCustomMenuItem(TO_CONTEXT_MENU, function() self:DoTake(inventorySlot, itemId) end)
  15.  
  16. end

The slot action changes is only needed if you also want to change the slot stuff like add a keybinding for it.

Originally Posted by mightyjo
Originally Posted by EgotisticalElf

Inventory Insight
Personal Assistant
FCO Item Saver

that's just off the top of my head.

shouldn't everyone be using libCustomMenu by now ?
Thanks! I was able to reproduce it with FCOIS and PA installed. Looks like we're all trying to put our menus in the same spot. Moving Take One to just under "Withdraw" fixed it.

Update incoming.
btw: your variable for the character SVs are never used: self.savedCharVariables
You should remove them so they do not create the tables in the SV files for nothing.
Last edited by Baertram : 05/21/21 at 09:11 AM.
Report comment to moderator  
Reply With Quote
Unread 05/20/21, 09:50 PM  
mightyjo
AddOn Author - Click to view AddOns

Forum posts: 1
File comments: 12
Uploads: 1
Originally Posted by EgotisticalElf

Inventory Insight
Personal Assistant
FCO Item Saver

that's just off the top of my head.

shouldn't everyone be using libCustomMenu by now ?
Thanks! I was able to reproduce it with FCOIS and PA installed. Looks like we're all trying to put our menus in the same spot. Moving Take One to just under "Withdraw" fixed it.

Update incoming.
Report comment to moderator  
Reply With Quote
Unread 05/20/21, 07:37 PM  
EgotisticalElf

Forum posts: 0
File comments: 20
Uploads: 0
Originally Posted by mightyjo
Originally Posted by EgotisticalElf
I love the idea, though my context menu gets messy..



Thoughts?
Thanks! I have a hunch it's an interaction between LibCustomMenu and an older way of inserting context menu items. Thought I'd guarded against it correctly.

Would you mind posting a list of the add-ons that are augmenting your menus? It'll help me reproduce the error.
Inventory Insight
Personal Assistant
FCO Item Saver

that's just off the top of my head.

shouldn't everyone be using libCustomMenu by now ?
Report comment to moderator  
Reply With Quote
Unread 05/20/21, 07:09 AM  
mightyjo
AddOn Author - Click to view AddOns

Forum posts: 1
File comments: 12
Uploads: 1
Originally Posted by EgotisticalElf
I love the idea, though my context menu gets messy..



Thoughts?
Thanks! I have a hunch it's an interaction between LibCustomMenu and an older way of inserting context menu items. Thought I'd guarded against it correctly.

Would you mind posting a list of the add-ons that are augmenting your menus? It'll help me reproduce the error.
Report comment to moderator  
Reply With Quote
Unread 05/19/21, 07:23 PM  
EgotisticalElf

Forum posts: 0
File comments: 20
Uploads: 0
I love the idea, though my context menu gets messy..



Thoughts?
Last edited by EgotisticalElf : 05/19/21 at 07:24 PM.
Report comment to moderator  
Reply With Quote
Post A Reply



Category Jump: