Thread Tools Display Modes
04/09/14, 02:04 AM   #1
Brack
Join Date: Apr 2014
Posts: 5
Add/Remove Items To/From Player Bank?

Hey Guys,

I've tried to find the function for this but I cant seem to. I want to add and remove items from the player's bank when at the bank screen. I see these two functions...
  • TransferToGuildBank(integer sourceBag, integer sourceSlot)
  • TransferFromGuildBank(integer slotId)
... but none for the player bank. Is this possible? Any ideas?

Thanks.
  Reply With Quote
04/09/14, 05:09 AM   #2
Xrystal
caritas omnia vincit
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2014
Posts: 369
PlaceInInventory protected (integer bagId, integer slotIndex)
PickupInventoryItem protected (integer bagId, integer slotIndex, integer count)

bagId would be 2 for the player bank, slotIndex the item you want taken out ( not necessarily the one you see at that position on screen though.
  Reply With Quote
04/09/14, 05:14 AM   #3
Wukar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 27
Or
  • TryBankItem(inventorySlot)
  • TryPlaceInventoryItemInEmptySlot(targetBag)
along with PLAYER_INVENTORY:IsBanking()
  Reply With Quote
04/09/14, 06:51 AM   #4
beeradg
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 16
None of those worked for me...

I submitted an addon that uses the "protected" functions - and works.

You have to do something like:
CallSecureProtected("PickupInventoryItem", fromBag, fromSlot, quantity)

Here's a git repo https://github.com/bradgearon/eso-stuff

Stuff.lua line 11 and 14 are the important chunks...
  Reply With Quote
04/09/14, 07:05 AM   #5
Xrystal
caritas omnia vincit
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2014
Posts: 369
Originally Posted by beeradg View Post
I submitted an addon that uses the "protected" functions - and works.

You have to do something like:
CallSecureProtected("PickupInventoryItem", fromBag, fromSlot, quantity)

Here's a git repo https://github.com/bradgearon/eso-stuff

Stuff.lua line 11 and 14 are the important chunks...
Interesting.I'm surprised that was allowed. Maybe one missed from their API clean out.
  Reply With Quote
04/09/14, 11:10 AM   #6
Brack
Join Date: Apr 2014
Posts: 5
Thanks everyone for the replies. I'm sure one of these suggestions will work.
  Reply With Quote
04/09/14, 12:22 PM   #7
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Feb 2014
Posts: 648
Originally Posted by Xrystal View Post
Interesting.I'm surprised that was allowed. Maybe one missed from their API clean out.
Well, protected =/= private. The CallSecureProtected() function sounds like their version of secure handlers in WoW.
  Reply With Quote
04/09/14, 12:02 PM   #8
Brack
Join Date: Apr 2014
Posts: 5
Originally Posted by Wukar View Post
  • TryBankItem(inventorySlot)
  • TryPlaceInventoryItemInEmptySlot(targetBag)
Neither of these functions (or variations) seem to exist.

Originally Posted by Xrystal View Post
PlaceInInventory protected (integer bagId, integer slotIndex)
PickupInventoryItem protected (integer bagId, integer slotIndex, integer count)
Originally Posted by beeradg View Post
You have to do something like:
CallSecureProtected("PickupInventoryItem", fromBag, fromSlot, quantity)
Okay so CallSecureProtected("PickupInventoryItem", fromBag, fromSlot, quantity) works, as an item in my inventory is placed in my mouse cursor, however that isn't the desired outcome. I want items to be moved to the bank without player interaction (or at least not more than one button click).

I then tried CallSecureProtected("PlaceInInventory", fromBag, fromSlot) but this didn't seem to be able to move banked items into the inventory.

So it seems I'm still stuck. Are we even supposed to be able to use protected functions? I thought the purpose of those was to not allow modders access to those. Seems pretty silly that moving items around in a player's inventory/bank space would be protected anyway.


Edit: Actually I think I got it working... Here is my code that worked (for testing):
Code:
CallSecureProtected("PickupInventoryItem", 1, 1, 1)
BankFirstEmpty = FindFirstEmptySlotInBag(2)
CallSecureProtected("PlaceInInventory", 2, BankFirstEmpty)
Thanks to everyone again for the help.

Last edited by Brack : 04/09/14 at 12:32 PM.
  Reply With Quote
04/09/14, 06:16 PM   #9
beeradg
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 16
Originally Posted by Brack View Post
Neither of these functions (or variations) seem to exist.





Okay so CallSecureProtected("PickupInventoryItem", fromBag, fromSlot, quantity) works, as an item in my inventory is placed in my mouse cursor, however that isn't the desired outcome. I want items to be moved to the bank without player interaction (or at least not more than one button click).

I then tried CallSecureProtected("PlaceInInventory", fromBag, fromSlot) but this didn't seem to be able to move banked items into the inventory.

So it seems I'm still stuck. Are we even supposed to be able to use protected functions? I thought the purpose of those was to not allow modders access to those. Seems pretty silly that moving items around in a player's inventory/bank space would be protected anyway.


Edit: Actually I think I got it working... Here is my code that worked (for testing):
Code:
CallSecureProtected("PickupInventoryItem", 1, 1, 1)
BankFirstEmpty = FindFirstEmptySlotInBag(2)
CallSecureProtected("PlaceInInventory", 2, BankFirstEmpty)
Thanks to everyone again for the help.
Glad that worked. From the code in that link I posted: (had the answer all along)
Code:
function stackItem(fromBag, fromSlot, toBag, toSlot, quantity, name)
    local result = true
    -- just in case
    ClearCursor()
    -- must call secure protected (pickup the item via cursor)
    result = CallSecureProtected("PickupInventoryItem", fromBag, fromSlot, quantity)
    if (result) then
        -- must call secure protected (drop the item on the cursor)
        result = CallSecureProtected("PlaceInInventory", toBag, toSlot)
    end
    -- clear the cursor to avoid issues
    ClearCursor()
    return result
end
  Reply With Quote

ESOUI » Developer Discussions » Lua/XML Help » Add/Remove Items To/From Player Bank?


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