refactorings
This commit is contained in:
+3
-39
@@ -163,7 +163,6 @@ function Postal:OnEnable()
|
|||||||
self:Hook('SendMailFrame_CanSend')
|
self:Hook('SendMailFrame_CanSend')
|
||||||
self:Hook('ContainerFrame_Update')
|
self:Hook('ContainerFrame_Update')
|
||||||
self:Hook('InboxFrame_OnClick')
|
self:Hook('InboxFrame_OnClick')
|
||||||
self:HookScript(TradeFrame, 'OnShow', 'TF_Show')
|
|
||||||
self:Hook('InboxFrameItem_OnEnter')
|
self:Hook('InboxFrameItem_OnEnter')
|
||||||
self:Hook('InboxFrame_Update')
|
self:Hook('InboxFrame_Update')
|
||||||
|
|
||||||
@@ -270,7 +269,7 @@ function Postal:ContainerFrameItemButton_OnClick(btn, ignore)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function Postal:PickupContainerItem(bag, slot)
|
function Postal:PickupContainerItem(bag, slot)
|
||||||
if (self:SelectedAttachment(bag, slot) or (Postal_itemToTrade and Postal_itemToTrade[1] == bag and Postal_itemToTrade[2] == slot)) then
|
if self:SelectedAttachment(bag, slot) then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
if not CursorHasItem() then
|
if not CursorHasItem() then
|
||||||
@@ -285,7 +284,7 @@ function Postal:UseContainerItem(bag, slot)
|
|||||||
return self.hooks["UseContainerItem"].orig(bag, slot)
|
return self.hooks["UseContainerItem"].orig(bag, slot)
|
||||||
end
|
end
|
||||||
|
|
||||||
if self:SelectedAttachment(bag, slot) or (Postal_itemToTrade and Postal_itemToTrade[1] == bag and Postal_itemToTrade[2] == slot) then
|
if self:SelectedAttachment(bag, slot) then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
if not CursorHasItem() then
|
if not CursorHasItem() then
|
||||||
@@ -315,15 +314,6 @@ function Postal:UseContainerItem(bag, slot)
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
end
|
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_itemToTrade = { bag, slot, UnitName("target"), 2 }
|
|
||||||
for i = 1, NUM_CONTAINER_FRAMES do
|
|
||||||
if getglobal("ContainerFrame" .. i):IsVisible() then
|
|
||||||
ContainerFrame_Update(getglobal("ContainerFrame" .. i))
|
|
||||||
end
|
|
||||||
end
|
|
||||||
return
|
|
||||||
end
|
end
|
||||||
|
|
||||||
self.hooks["UseContainerItem"].orig(bag, slot)
|
self.hooks["UseContainerItem"].orig(bag, slot)
|
||||||
@@ -518,8 +508,7 @@ function Postal:ContainerFrame_Update(frame)
|
|||||||
for j=1, frame.size, 1 do
|
for j=1, frame.size, 1 do
|
||||||
local itemButton = getglobal(name.."Item"..j)
|
local itemButton = getglobal(name.."Item"..j)
|
||||||
local bag, slot = itemButton:GetParent():GetID(), itemButton:GetID()
|
local bag, slot = itemButton:GetParent():GetID(), itemButton:GetID()
|
||||||
local locked = self:SelectedAttachment(bag, slot) or self:QueuedAttachment(bag, slot) or (Postal_itemToTrade and Postal_itemToTrade[1] == bag and Postal_itemToTrade[2] == slot)
|
if self:SelectedAttachment(bag, slot) or self:QueuedAttachment(bag, slot) then
|
||||||
if locked then
|
|
||||||
SetItemButtonDesaturated(itemButton, true, 0.5, 0.5, 0.5)
|
SetItemButtonDesaturated(itemButton, true, 0.5, 0.5, 0.5)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -560,30 +549,6 @@ function Postal:InboxFrameItem_OnEnter()
|
|||||||
GameTooltip:Show()
|
GameTooltip:Show()
|
||||||
end
|
end
|
||||||
|
|
||||||
function Postal:TF_Show()
|
|
||||||
self.hooks[TradeFrame].OnShow.orig()
|
|
||||||
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_itemToTrade = nil
|
|
||||||
end
|
|
||||||
|
|
||||||
function Postal:Inbox_OnUpdate(elapsed)
|
|
||||||
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))
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
function Postal:UI_ERROR_MESSAGE()
|
function Postal:UI_ERROR_MESSAGE()
|
||||||
if event == "UI_ERROR_MESSAGE" and (arg1 == ERR_INV_FULL or arg1 == ERR_ITEM_MAX_COUNT) then
|
if event == "UI_ERROR_MESSAGE" and (arg1 == ERR_INV_FULL or arg1 == ERR_ITEM_MAX_COUNT) then
|
||||||
if this.num then
|
if this.num then
|
||||||
@@ -683,6 +648,5 @@ function Postal:Inbox_Abort()
|
|||||||
Postal.open.stop()
|
Postal.open.stop()
|
||||||
PostalInboxFrame.opening = false
|
PostalInboxFrame.opening = false
|
||||||
Postal:Inbox_DisableClicks()
|
Postal:Inbox_DisableClicks()
|
||||||
PostalInboxFrame.id = {}
|
|
||||||
Postal_SelectedItems = {}
|
Postal_SelectedItems = {}
|
||||||
end
|
end
|
||||||
@@ -207,11 +207,6 @@ C:\Projects\WoW\Bin\Interface\FrameXML\UI.xsd">
|
|||||||
</Frame>
|
</Frame>
|
||||||
|
|
||||||
<Frame name="PostalInboxFrame" parent="UIParent">
|
<Frame name="PostalInboxFrame" parent="UIParent">
|
||||||
<Scripts>
|
|
||||||
<OnUpdate>
|
|
||||||
Postal:Inbox_OnUpdate(arg1)
|
|
||||||
</OnUpdate>
|
|
||||||
</Scripts>
|
|
||||||
</Frame>
|
</Frame>
|
||||||
<CheckButton name="PostalBoxItemCBTemplate" hidden="true" virtual="true" inherits="OptionsCheckButtonTemplate">
|
<CheckButton name="PostalBoxItemCBTemplate" hidden="true" virtual="true" inherits="OptionsCheckButtonTemplate">
|
||||||
<HitRectInsets>
|
<HitRectInsets>
|
||||||
|
|||||||
Reference in New Issue
Block a user