WoWInterface SVN SplitItemsOnTheFly

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /
    from Rev 11 to Rev 12
    Reverse comparison

Rev 11 → Rev 12

trunk/core.lua
27,35 → 27,50
SI.Cursor:EnableMouseWheel(0)
SI.Cursor.text:SetText("")
SI.Cursor:SetScript('OnMouseWheel',function(self,arg1)
local i = tonumber(self.text:GetText())
local c
if not i then
c=arg1%SI.count
else
c = i+arg1
end
--if c<0 then it would drop automaticly
if c==1 then
ClearCursor()
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)
local i = tonumber(self.text:GetText()) or 0
local c
if handling=='merchant' then
if not i then
c=arg1%SI.count
else
--c=i+arg1
c = i+(arg1*SI.minStack)
if c<0 then
c=SI.count
elseif c>SI.count then
c=0
end
end
self.text:SetText(c)
else
if not i then
c=arg1%SI.count
else
c=(i+arg1)%SI.count
end
--if c<0 then it would drop automaticly
if c==1 then
ClearCursor()
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(1)
elseif c>=SI.count or c==0 then
ClearCursor()
SplitContainerItem(SI.bagID,SI.bagSlot,SI.count)
self.text:SetText("")
else
ClearCursor()
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
self.text:SetText(1)
elseif c>=SI.count or c==0 then
ClearCursor()
SplitContainerItem(SI.bagID,SI.bagSlot,SI.count)
self.text:SetText("")
else
ClearCursor()
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)
 
local events = { }
116,9 → 131,47
end
end
 
--ONLY-ACTIVE if Merchant Window is shown
function events:CURSOR_UPDATE()
local info1,index = GetCursorInfo()
if info1=='merchant' then
handling,SI.buyIndex='merchant',index
SI.count=select(8,GetItemInfo(GetMerchantItemInfo(index))) or 1
--SI.count=GetMerchantItemMaxStack(index)
SI.minStack = select(4,GetMerchantItemInfo(index))
SI.Cursor.text:SetPoint('BOTTOMLEFT',SI.Cursor,'BOTTOMLEFT',GetScaledCursorPosition(0,0) )
SI.Cursor.text:SetText(SI.minStack)
SI.Cursor:EnableMouseWheel(1)
elseif not info1 and not index and SI.buyIndex and not SI.throttle then
if SI.buyIndex then
SI.throttle=true
local qty = tonumber(SI.Cursor.text:GetText())
if qty ~= 0 then -- buy not
BuyMerchantItem(SI.buyIndex,(qty/SI.minStack))
end
SI.Cursor.text:SetText("")
SI.Cursor:EnableMouseWheel(0)
SI.buyIndex=nil
SI.throttle=false
end
end
end
 
function events:MERCHANT_SHOW()
--self = SI.handler
self:RegisterEvent('CURSOR_UPDATE')
end
 
function events:MERCHANT_CLOSED()
--unregisterEvent
self:UnregisterEvent('CURSOR_UPDATE')
end
 
SI.handler = CreateFrame('Frame',SI.name.."_Handler",nil)
SI.handler:RegisterEvent('ITEM_LOCK_CHANGED')
SI.handler:RegisterEvent('GUILDBANK_ITEM_LOCK_CHANGED')
SI.handler:RegisterEvent('MERCHANT_SHOW')
SI.handler:RegisterEvent('MERCHANT_CLOSED')
SI.handler:SetScript('OnEvent',function(self,event,...)
handling = event
--print(...)