A Cobalt Mageweaver
Join Date: Mar 2005
Posts: 219
|
Fetching items from the GuildBank
I need some help! The first function (code fragment) fails to fetch an item from the GuildBank. It is modeled after the second function (code fragment) which succeeds in fetching an item from the (character) Bank.
The third code segment is the output of the failing function and the fourth is the output of the working function. There is one stack of the item in the GuildBank and two stacks of the item in the bank. Other than that, the two outputs appear to be functionally equivalent (to me). This is why I'm stumped!
These code fragments are from Skillet ( http://www.wowinterface.com/download...1-Skillet.html) and can be downloaded in its current alpha state (complete with bugs) at http://www.wowinterface.com/downloads/info22757.html.
Code:
local function getItemFromGuildBank(itemID, bag, slot, count)
print("getItemFromGuildBank(",itemID,", ", bag,", ", slot,", ", count,")")
ClearCursor()
local _, available = GetGuildBankItemInfo(bag, slot)
local link = GetGuildBankItemLink(bag, slot)
local num_moved = 0
if available == 1 or count >= available then
print("PickupGuildBankItem(",bag,", ", slot,")")
PickupGuildBankItem(bag, slot)
num_moved = available
else
print("SplitGuildBankItem(",bag,", ", slot,", ", count,")")
SplitGuildBankItem(bag, slot, count)
num_moved = count
end
local type, data, subType, subData = GetCursorInfo()
print("type=",type,", data=",data,", subType=",subType)
local tobag = findBagForItem(itemID, num_moved)
print("tobag=",tobag,", findBagForItem(",itemID,", ", num_moved,")")
if not tobag then
Skillet:Print(L["Could not find bag space for"] .. ": " .. link)
return 0
end
if tobag == 0 then
print("PutItemInBackpack()")
PutItemInBackpack()
else
print("PutItemInBag(",ContainerIDToInventoryID(tobag),")")
PutItemInBag(ContainerIDToInventoryID(tobag))
end
return num_moved
end
Code:
local function getItemFromBank(itemID, bag, slot, count)
print("getItemFromBank(",itemID,", ", bag,", ", slot,", ", count,")")
ClearCursor()
local _, available = GetContainerItemInfo(bag, slot)
local link = GetContainerItemLink(bag, slot)
local num_moved = 0
if available == 1 or count >= available then
print("PickupContainerItem(",bag,", ", slot,")")
PickupContainerItem(bag, slot)
num_moved = available
else
print("SplitContainerItem(",bag,", ", slot,", ", count,")")
SplitContainerItem(bag, slot, count)
num_moved = count
end
local type, data, subType, subData = GetCursorInfo()
print("type=",type,", data=",data,", subType=",subType)
local tobag = findBagForItem(itemID, num_moved)
print("tobag=",tobag,", findBagForItem(",itemID,", ", num_moved,")")
if not tobag then
Skillet:Print(L["Could not find bag space for"] .. ": " .. link)
return 0
end
if tobag == 0 then
print("PutItemInBackpack()")
PutItemInBackpack()
else
print("PutItemInBag(",ContainerIDToInventoryID(tobag),")")
PutItemInBag(ContainerIDToInventoryID(tobag))
end
return num_moved
end
Code:
GUILDBANKFRAME_OPENED
CURSOR_UPDATE - type= nil , data= nil , subType= nil
GUILDBANKBAGSLOTS_CHANGED
GUILDBANKBAGSLOTS_CHANGED
GUILDBANKBAGSLOTS_CHANGED
GUILDBANKBAGSLOTS_CHANGED
GUILDBANKBAGSLOTS_CHANGED
GUILDBANKBAGSLOTS_CHANGED
GUILDBANKBAGSLOTS_CHANGED
indexGuildBank size= 546
getItemFromGuildBank( 76142 , 1 , 20 , 1 )
CURSOR_UPDATE - type= nil , data= nil , subType= nil
SplitGuildBankItem( 1 , 20 , 1 )
CURSOR_UPDATE - type= item , data= 76142 , subType= [Sun's Radiance]
type= item , data= 76142 , subType= [Sun's Radiance]
tobag= 0 , findBagForItem( 76142 , 1 )
PutItemInBackpack()
CURSOR_UPDATE - type= nil , data= nil , subType= nil
GUILDBANKFRAME_CLOSED
Code:
BANKFRAME_OPENED
CURSOR_UPDATE - type= nil , data= nil , subType= nil
indexBank size= 218
getItemFromBank( 76142 , 10 , 2 , 1 )
CURSOR_UPDATE - type= nil , data= nil , subType= nil
SplitContainerItem( 10 , 2 , 1 )
CURSOR_UPDATE - type= item , data= 76142 , subType= [Sun's Radiance]
type= item , data= 76142 , subType= [Sun's Radiance]
tobag= 0 , findBagForItem( 76142 , 1 )
PutItemInBackpack()
CURSOR_UPDATE - type= nil , data= nil , subType= nil
getItemFromBank( 76142 , 10 , 6 , 0 )
CURSOR_UPDATE - type= nil , data= nil , subType= nil
SplitContainerItem( 10 , 6 , 0 )
type= nil , data= nil , subType= nil
tobag= 0 , findBagForItem( 76142 , 0 )
PutItemInBackpack()
CURSOR_UPDATE - type= nil , data= nil , subType= nil
BANKFRAME_CLOSED
|