mirror of
https://github.com/brues-code/pfUI.git
synced 2026-09-22 15:46:56 +00:00
710be52f35
Drop the now-vestigial expansion plumbing.
- Delete modules/thirdparty-tbc.lua + its xml Include
- Strip 10 tbc-tagged CreateConfig calls in modules/gui.lua
- Drop the expansion arg from CreateConfig() signature + the disabled-
entry rendering path that depended on it
- Drop the showdisabled GUI toggle + its default
- Simplify pfUI:RegisterModule / pfUI:RegisterSkin to (name, func) only
- Strip the leading version arg ("vanilla:tbc", etc.) from all 114
Register call sites
- Delete the pfUI.expansion variable
65 lines
2.2 KiB
Lua
65 lines
2.2 KiB
Lua
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
|
|
|
|
-- helper functions
|
|
local IsTrading = function()
|
|
return TradeFrame:IsShown()
|
|
end
|
|
|
|
local IsAuctionBrowsing = function()
|
|
return AuctionFrame and AuctionFrame:IsShown() and AuctionFrameBrowse and AuctionFrameBrowse:IsShown()
|
|
end
|
|
|
|
local IsAuctionSelling = function()
|
|
return AuctionFrame and AuctionFrame:IsShown() and AuctionFrameAuctions and AuctionFrameAuctions:IsShown()
|
|
end
|
|
|
|
-- overwrite use/trade logic unless shift is pressed
|
|
local pfHookUseContainerItem = _G.UseContainerItem
|
|
function _G.UseContainerItem(bag, slot)
|
|
if IsTrading() and not IsShiftKeyDown() then
|
|
-- move item to trade window
|
|
PickupContainerItem(bag, slot)
|
|
local slot = TradeFrame_GetAvailableSlot()
|
|
if slot then ClickTradeButton(slot) end
|
|
if CursorHasItem() then
|
|
ClearCursor()
|
|
end
|
|
elseif IsAuctionBrowsing() and not IsShiftKeyDown() then
|
|
-- search item in auction house
|
|
local name = C_Item.GetItemName(ItemLocation:CreateFromBagAndSlot(bag, slot))
|
|
BrowseName:SetText(name)
|
|
AuctionFrameBrowse_Search()
|
|
elseif IsAuctionSelling() and not IsShiftKeyDown() then
|
|
-- sell item to auction house
|
|
PickupContainerItem(bag, slot)
|
|
AuctionsItemButton:Click()
|
|
if CursorHasItem() then
|
|
ClearCursor()
|
|
end
|
|
else
|
|
-- default action
|
|
pfHookUseContainerItem(bag, slot)
|
|
end
|
|
end
|
|
|
|
-- detect bag button tooltips
|
|
local showHelperNextTooltip = false
|
|
local pfHookSetBagItem = GameTooltip.SetBagItem
|
|
function GameTooltip.SetBagItem(self, container, slot)
|
|
showHelperNextTooltip = IsTrading() or IsAuctionBrowsing() or IsAuctionSelling()
|
|
return pfHookSetBagItem(self, container, slot)
|
|
end
|
|
|
|
-- add helper text to tooltips
|
|
local tooltip = CreateFrame("Frame", "pfItemClickHelpMessage", GameTooltip)
|
|
tooltip:SetScript("OnShow", function()
|
|
if showHelperNextTooltip then
|
|
GameTooltip:AddLine(T["Hold [Shift] to use item."], 0.50, 0.75, 1.00)
|
|
GameTooltip:Show()
|
|
showHelperNextTooltip = false
|
|
end
|
|
end)
|
|
end)
|