WoWInterface SVN SplitItemsOnTheFly

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /
    from Rev 1 to Rev 2
    Reverse comparison

Rev 1 → Rev 2

trunk/core.lua New file
0,0 → 1,65
--[[
##AddOn : SplitItemsOnTheFly
##Subfile : core.lua
##Author : Hati-EK
--]]
--debug issues only
SplitItemsOnTheFly = { }
local SI = SplitItemsOnTheFly
SI.name = 'SplitItemsOnTheFly'
SI.ver = GetAddOnMetadata( SI.name, 'Version')
if SI.ver=='rwowi:revision' then SI.ver='SVN' end
 
local function GetScaledCursorPosition(xOffset,yOffset)
if not xOffset then xOffset=0 end
if not yOffset then yOffset=0 end
local scale, x,y = UIParent:GetScale(),GetCursorPosition()
return (x/scale +xOffset), (y/scale +yOffset)
end
 
SI.Cursor = CreateFrame('Frame',SI.name.."_Cursor",UIParent)
SI.Cursor:SetAllPoints(UIParent)
SI.Cursor.text = SI.Cursor:CreateFontString(SI.name.."_CursorText","ARTWORK")
SI.Cursor:SetFrameStrata('TOOLTIP')
SI.Cursor.text:SetPoint('CENTER',SI.Cursor,'CENTER',10,-10)
SI.Cursor.text:SetFont("Fonts\\FRIZQT__.TTF",18,"OUTLINE")
SI.Cursor:EnableMouseWheel(0)
SI.Cursor.text:SetText("")
SI.Cursor:SetScript('OnMouseWheel',function(self,arg1)
local i = tonumber(self.text:GetText()) or 1
local c = i+arg1
--if c<0 then it would drop automaticly
if c<=1 then
if c==1 then
ClearCursor()
SplitContainerItem(SI.bagID,SI.bagSlot,c)
end
self.text:SetText("")
elseif c>SI.count then
self.text:SetText(SI.count)
else
ClearCursor()
SplitContainerItem(SI.bagID,SI.bagSlot,c)
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)
_,SI.count,lock = GetContainerItemInfo(...)
--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 = ...
SI.Cursor.text:SetText(SI.count)
--Item isn't splitable and got dropped
else
SI.Cursor.text:SetText("")
SI.Cursor:EnableMouseWheel(0)
end
end)
 
trunk/SplitItemsOnTheFly.toc New file
0,0 → 1,7
## Interface: 30300
## Title: SplitItemsOnTheFly
## Notes: Enables to split or change the amount of split while having the item picked up.
## Version: rwowi:revision
## Author: Hati-EK
 
core.lua