slight improvement for graying out attachmentss
This commit is contained in:
+13
-26
@@ -1,12 +1,8 @@
|
|||||||
local self = CreateFrame('Frame', nil, MailFrame)
|
local self = CreateFrame('Frame', nil, MailFrame)
|
||||||
Postal = self
|
Postal = self
|
||||||
self:SetScript('OnUpdate', function()
|
self:SetScript('OnUpdate', function() this:UPDATE() end)
|
||||||
this:UPDATE()
|
self:SetScript('OnEvent', function() this[event](this) end)
|
||||||
end)
|
for _, event in {'ADDON_LOADED', 'VARIABLES_LOADED', 'UI_ERROR_MESSAGE', 'CURSOR_UPDATE', 'BAG_UPDATE', 'MAIL_CLOSED', 'MAIL_SEND_SUCCESS'} do
|
||||||
self:SetScript('OnEvent', function()
|
|
||||||
this[event](this)
|
|
||||||
end)
|
|
||||||
for _, event in {'ADDON_LOADED', 'VARIABLES_LOADED', 'UI_ERROR_MESSAGE', 'CURSOR_UPDATE', 'MAIL_CLOSED', 'MAIL_SEND_SUCCESS'} do
|
|
||||||
self:RegisterEvent(event)
|
self:RegisterEvent(event)
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -34,17 +30,11 @@ do
|
|||||||
end
|
end
|
||||||
|
|
||||||
function self:When(predicate, callback)
|
function self:When(predicate, callback)
|
||||||
state = {
|
state = {predicate = predicate, callback = callback}
|
||||||
predicate = predicate,
|
|
||||||
callback = callback,
|
|
||||||
}
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function self:Wait(callback)
|
function self:Wait(callback)
|
||||||
state = {
|
state = {predicate = function() return true end, callback = callback}
|
||||||
predicate = function() return true end,
|
|
||||||
callback = callback,
|
|
||||||
}
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function self:Kill()
|
function self:Kill()
|
||||||
@@ -70,6 +60,10 @@ do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function self:BAG_UPDATE()
|
||||||
|
SendMailFrame_Update()
|
||||||
|
end
|
||||||
|
|
||||||
function self:MAIL_CLOSED()
|
function self:MAIL_CLOSED()
|
||||||
self:Abort()
|
self:Abort()
|
||||||
self.Inbox_selectedItems = {}
|
self.Inbox_selectedItems = {}
|
||||||
@@ -78,9 +72,7 @@ function self:MAIL_CLOSED()
|
|||||||
-- Hides the minimap unread mail button if there are no unread mail on closing the mailbox.
|
-- Hides the minimap unread mail button if there are no unread mail on closing the mailbox.
|
||||||
-- Does not scan past the first 50 items since only the first 50 are viewable.
|
-- Does not scan past the first 50 items since only the first 50 are viewable.
|
||||||
for i=1,GetInboxNumItems() do
|
for i=1,GetInboxNumItems() do
|
||||||
if not ({GetInboxHeaderInfo(i)})[9] then
|
if not ({GetInboxHeaderInfo(i)})[9] then return end
|
||||||
return
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
MiniMapMailFrame:Hide()
|
MiniMapMailFrame:Hide()
|
||||||
end
|
end
|
||||||
@@ -174,7 +166,7 @@ end
|
|||||||
function self:VARIABLES_LOADED()
|
function self:VARIABLES_LOADED()
|
||||||
self:Hook(
|
self:Hook(
|
||||||
'InboxFrame_Update','InboxFrame_OnClick', 'InboxFrameItem_OnEnter',
|
'InboxFrame_Update','InboxFrame_OnClick', 'InboxFrameItem_OnEnter',
|
||||||
'SendMailFrame_Update', 'SendMailFrame_CanSend', 'ClickSendMailItemButton', 'SetItemButtonDesaturated', 'PickupContainerItem', 'SplitContainerItem', 'UseContainerItem'
|
'SendMailFrame_Update', 'SendMailFrame_CanSend', 'ClickSendMailItemButton', 'GetContainerItemInfo', 'PickupContainerItem', 'SplitContainerItem', 'UseContainerItem'
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -325,7 +317,7 @@ function self.hook.SendMailFrame_Update()
|
|||||||
local itemCount = 0
|
local itemCount = 0
|
||||||
local itemTitle
|
local itemTitle
|
||||||
local gap
|
local gap
|
||||||
-- local last = 0
|
-- local last = 0 blizzlike
|
||||||
local last = self:SendMail_NumAttachments()
|
local last = self:SendMail_NumAttachments()
|
||||||
|
|
||||||
for i=1,ATTACHMENTS_MAX do
|
for i=1,ATTACHMENTS_MAX do
|
||||||
@@ -449,15 +441,10 @@ end
|
|||||||
function self.hook.GetContainerItemInfo(...)
|
function self.hook.GetContainerItemInfo(...)
|
||||||
local item = {arg[1], arg[2]}
|
local item = {arg[1], arg[2]}
|
||||||
local ret = {self.orig.GetContainerItemInfo(unpack(arg))}
|
local ret = {self.orig.GetContainerItemInfo(unpack(arg))}
|
||||||
ret[3] = ret[3] or self.SendMail_Attached(item)
|
ret[3] = ret[3] or self:SendMail_Attached(item)
|
||||||
return unpack(ret)
|
return unpack(ret)
|
||||||
end
|
end
|
||||||
|
|
||||||
function self.hook.SetItemButtonDesaturated(itemButton, locked)
|
|
||||||
local item = {itemButton:GetParent():GetID(), itemButton:GetID()}
|
|
||||||
return self.orig.SetItemButtonDesaturated(itemButton, self:SendMail_Attached(item) or locked)
|
|
||||||
end
|
|
||||||
|
|
||||||
function self.hook.PickupContainerItem(...)
|
function self.hook.PickupContainerItem(...)
|
||||||
local item = {arg[1], arg[2]}
|
local item = {arg[1], arg[2]}
|
||||||
if self:SendMail_Attached(item) then return end
|
if self:SendMail_Attached(item) then return end
|
||||||
|
|||||||
Reference in New Issue
Block a user