WoWInterface SVN SplitItemsOnTheFly

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /
    from Rev 6 to Rev 7
    Reverse comparison

Rev 6 → Rev 7

trunk/core.lua
9,6 → 9,8
SI.ver = GetAddOnMetadata( SI.name, 'Version')
if SI.ver=='rwowi:revision' then SI.ver='SVN' end
 
local handling = nil
 
local function GetScaledCursorPosition(xOffset,yOffset)
if not xOffset then xOffset=0 end
if not yOffset then yOffset=0 end
31,22 → 33,29
if c<=1 then
if c==1 then
ClearCursor()
SplitContainerItem(SI.bagID,SI.bagSlot,c)
if handling=='ITEM_LOCK_CHANGED' then
SplitContainerItem(SI.bagID,SI.bagSlot,c)
elseif handling=='GUILDBANK_ITEM_LOCK_CHANGED' then
SplitGuildBankItem(SI.bagID,SI.bagSlot,c)
end
end
self.text:SetText("")
elseif c>SI.count then
self.text:SetText(SI.count)
else
ClearCursor()
SplitContainerItem(SI.bagID,SI.bagSlot,c)
if handling=='ITEM_LOCK_CHANGED' then
SplitContainerItem(SI.bagID,SI.bagSlot,c)
elseif handling=='GUILDBANK_ITEM_LOCK_CHANGED' then
SplitGuildBankItem(SI.bagID,SI.bagSlot,c)
end
self.text:SetText(c)
end
end)
 
SI.handler = CreateFrame('Frame',SI.name.."_Handler",nil)
SI.handler:RegisterEvent('ITEM_LOCK_CHANGED')
SI.handler:SetScript('OnEvent',function(self,event,...)
--Get Count (initial Count)
local events = { }
function events:ITEM_LOCK_CHANGED(...)
--Get Count (initial Count)
_,SI.count,lock = GetContainerItemInfo(...)
--Item is splitable and got picked up
if SI.count > 1 and lock then
60,5 → 69,51
SI.Cursor.text:SetText("")
SI.Cursor:EnableMouseWheel(0)
end
end
 
local function GetGuildBankLockedItem()
local rtab, rslot
for tab=1,GetNumGuildBankTabs() do
for slot=1,MAX_GUILDBANK_SLOTS_PER_TAB do
if select(3,GetGuildBankItemInfo(tab,slot)) then
rtab=tab
rslot=slot
break
end
end
end
return rtab,rslot
end
 
function events:GUILDBANK_ITEM_LOCK_CHANGED()
--Get Count (initial Count)
local tab,slot = GetGuildBankLockedItem()
if tab and slot then
_,SI.count,lock = GetGuildBankItemInfo(tab,slot)
--Item is splitable and got picked up
if SI.count > 1 and lock then
--print('EnableMouseWheel')
SI.Cursor.text:SetPoint('BOTTOMLEFT',SI.Cursor,'BOTTOMLEFT',GetScaledCursorPosition(0,0) )
SI.Cursor:EnableMouseWheel(1)
SI.bagID,SI.bagSlot = tab,slot
SI.Cursor.text:SetText(SI.count)
--Item isn't splitable and got dropped
else
SI.Cursor.text:SetText("")
SI.Cursor:EnableMouseWheel(0)
end
else
SI.Cursor.text:SetText("")
SI.Cursor:EnableMouseWheel(0)
end
end
 
SI.handler = CreateFrame('Frame',SI.name.."_Handler",nil)
SI.handler:RegisterEvent('ITEM_LOCK_CHANGED')
SI.handler:RegisterEvent('GUILDBANK_ITEM_LOCK_CHANGED')
SI.handler:SetScript('OnEvent',function(self,event,...)
handling = event
--print(...)
events[event](self, ...)
end)