refactorings
This commit is contained in:
+12
-12
@@ -270,8 +270,8 @@ function Postal:ContainerFrameItemButton_OnClick(btn, ignore)
|
||||
self.hooks["ContainerFrameItemButton_OnClick"].orig(btn, ignore)
|
||||
end
|
||||
|
||||
function Postal:PickupContainerItem(bag, slot, special)
|
||||
if (self:GetAttachmentFrame(bag, slot) or (Postal_addItem and Postal_addItem[1] == bag and Postal_addItem[2] == slot)) and not special then
|
||||
function Postal:PickupContainerItem(bag, slot)
|
||||
if (self:GetAttachmentFrame(bag, slot) or (Postal_itemToTrade and Postal_itemToTrade[1] == bag and Postal_itemToTrade[2] == slot)) then
|
||||
return
|
||||
end
|
||||
if not CursorHasItem() then
|
||||
@@ -286,7 +286,7 @@ function Postal:UseContainerItem(bag, slot)
|
||||
return self.hooks["UseContainerItem"].orig(bag, slot)
|
||||
end
|
||||
|
||||
if self:GetAttachmentFrame(bag, slot) or (Postal_addItem and Postal_addItem[1] == bag and Postal_addItem[2] == slot) then
|
||||
if self:GetAttachmentFrame(bag, slot) or (Postal_itemToTrade and Postal_itemToTrade[1] == bag and Postal_itemToTrade[2] == slot) then
|
||||
return
|
||||
end
|
||||
if not CursorHasItem() then
|
||||
@@ -318,7 +318,7 @@ function Postal:UseContainerItem(bag, slot)
|
||||
end
|
||||
elseif not CursorHasItem() and (not TradeFrame or not TradeFrame:IsVisible()) and (not AuctionFrame or not AuctionFrame:IsVisible()) and UnitExists("target") and CheckInteractDistance("target", 2) and UnitIsFriend("player", "target") and UnitIsPlayer("target") then
|
||||
InitiateTrade("target")
|
||||
Postal_addItem = { bag, slot, UnitName("target"), 2 }
|
||||
Postal_itemToTrade = { bag, slot, UnitName("target"), 2 }
|
||||
for i = 1, NUM_CONTAINER_FRAMES do
|
||||
if getglobal("ContainerFrame" .. i):IsVisible() then
|
||||
ContainerFrame_Update(getglobal("ContainerFrame" .. i))
|
||||
@@ -537,7 +537,7 @@ function Postal:ContainerFrame_Update(frame)
|
||||
for j=1, frame.size, 1 do
|
||||
local itemButton = getglobal(name.."Item"..j)
|
||||
local bag, slot = itemButton:GetParent():GetID(), itemButton:GetID()
|
||||
local locked = self:GetAttachmentFrame(bag, slot) or self:QueuedAttachment(bag, slot) or (Postal_addItem and Postal_addItem[1] == bag and Postal_addItem[2] == slot)
|
||||
local locked = self:GetAttachmentFrame(bag, slot) or self:QueuedAttachment(bag, slot) or (Postal_itemToTrade and Postal_itemToTrade[1] == bag and Postal_itemToTrade[2] == slot)
|
||||
if locked then
|
||||
SetItemButtonDesaturated(itemButton, true, 0.5, 0.5, 0.5)
|
||||
end
|
||||
@@ -581,19 +581,19 @@ end
|
||||
|
||||
function Postal:TF_Show()
|
||||
self.hooks[TradeFrame].OnShow.orig()
|
||||
if Postal_addItem and not CursorHasItem() and UnitName("NPC") == Postal_addItem[3] then
|
||||
self.hooks["PickupContainerItem"].orig(Postal_addItem[1], Postal_addItem[2])
|
||||
if Postal_itemToTrade and not CursorHasItem() and UnitName("NPC") == Postal_itemToTrade[3] then
|
||||
self.hooks["PickupContainerItem"].orig(Postal_itemToTrade[1], Postal_itemToTrade[2])
|
||||
|
||||
ClickTradeButton(1)
|
||||
end
|
||||
Postal_addItem = nil
|
||||
Postal_itemToTrade = nil
|
||||
end
|
||||
|
||||
function Postal:Inbox_OnUpdate(elapsed)
|
||||
if Postal_addItem then
|
||||
Postal_addItem[4] = Postal_addItem[4] - elapsed
|
||||
if Postal_addItem[4] <= 0 then
|
||||
Postal_addItem = nil
|
||||
if Postal_itemToTrade then
|
||||
Postal_itemToTrade[4] = Postal_itemToTrade[4] - elapsed
|
||||
if Postal_itemToTrade[4] <= 0 then
|
||||
Postal_itemToTrade = nil
|
||||
for i = 1, NUM_CONTAINER_FRAMES do
|
||||
if getglobal("ContainerFrame" .. i):IsVisible() then
|
||||
ContainerFrame_Update(getglobal("ContainerFrame" .. i))
|
||||
|
||||
Reference in New Issue
Block a user