mirror of
https://github.com/brues-code/pfUI.git
synced 2026-09-30 19:19:59 +00:00
itemclick: move click handler into seperate module
This commit is contained in:
+2
-1
@@ -42,8 +42,9 @@ end
|
||||
|
||||
-- blacklist unrequired modules
|
||||
pfUI.module.autoshift = true
|
||||
pfUI.module.itemclick = true
|
||||
|
||||
-- keyring returns
|
||||
-- the function GetContainerNumSlots returns numbers for keyrings in tbc
|
||||
function pfUI.api.GetContainerNumSlots(bag)
|
||||
if bag == -2 and pfUI.bag and not pfUI.bag.showKeyring then
|
||||
return 0
|
||||
|
||||
@@ -45,33 +45,6 @@ pfUI:RegisterModule("bags", function ()
|
||||
return
|
||||
end
|
||||
|
||||
local pfHookUseContainerItem = _G.UseContainerItem
|
||||
function _G.UseContainerItem(bag,slot)
|
||||
if TradeFrame:IsShown() then
|
||||
PickupContainerItem(bag,slot)
|
||||
local slot = TradeFrame_GetAvailableSlot()
|
||||
if slot then ClickTradeButton(slot) end
|
||||
if CursorHasItem() then
|
||||
ClearCursor()
|
||||
end
|
||||
elseif AuctionFrame and AuctionFrame:IsShown() and
|
||||
AuctionFrameBrowse and AuctionFrameBrowse:IsShown() then
|
||||
local link = GetContainerItemLink(bag,slot)
|
||||
local name = link and string.sub(link, string.find(link, "%[")+1, string.find(link, "%]")-1) or ""
|
||||
BrowseName:SetText(name)
|
||||
AuctionFrameBrowse_Search()
|
||||
elseif AuctionFrame and AuctionFrame:IsShown() and
|
||||
AuctionFrameAuctions and AuctionFrameAuctions:IsShown() then
|
||||
PickupContainerItem(bag,slot)
|
||||
AuctionsItemButton:Click()
|
||||
if CursorHasItem() then
|
||||
ClearCursor()
|
||||
end
|
||||
else
|
||||
pfHookUseContainerItem(bag,slot)
|
||||
end
|
||||
end
|
||||
|
||||
-- hide blizzard's bankframe
|
||||
BankFrame:SetScale(0.001)
|
||||
BankFrame:SetPoint("TOPLEFT", 0,0)
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
pfUI:RegisterModule("itemclick", function ()
|
||||
-- small module that tries to decide if an item should be used or dropped into
|
||||
-- the auctionhouse search or trade window
|
||||
|
||||
local pfHookUseContainerItem = _G.UseContainerItem
|
||||
function _G.UseContainerItem(bag,slot)
|
||||
if TradeFrame:IsShown() then
|
||||
PickupContainerItem(bag,slot)
|
||||
local slot = TradeFrame_GetAvailableSlot()
|
||||
if slot then ClickTradeButton(slot) end
|
||||
if CursorHasItem() then
|
||||
ClearCursor()
|
||||
end
|
||||
elseif AuctionFrame and AuctionFrame:IsShown() and
|
||||
AuctionFrameBrowse and AuctionFrameBrowse:IsShown() then
|
||||
local link = GetContainerItemLink(bag,slot)
|
||||
local name = link and string.sub(link, string.find(link, "%[")+1, string.find(link, "%]")-1) or ""
|
||||
BrowseName:SetText(name)
|
||||
AuctionFrameBrowse_Search()
|
||||
elseif AuctionFrame and AuctionFrame:IsShown() and
|
||||
AuctionFrameAuctions and AuctionFrameAuctions:IsShown() then
|
||||
PickupContainerItem(bag,slot)
|
||||
AuctionsItemButton:Click()
|
||||
if CursorHasItem() then
|
||||
ClearCursor()
|
||||
end
|
||||
else
|
||||
pfHookUseContainerItem(bag,slot)
|
||||
end
|
||||
end
|
||||
end)
|
||||
Reference in New Issue
Block a user